@boostxyz/sdk 0.0.0-alpha.3 → 0.0.0-alpha.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +2 -1
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.d.ts +1 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +15 -13
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/EventAction.cjs +1 -0
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.js +1 -0
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +2 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.d.ts +1 -2
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +16 -14
- package/dist/AllowLists/AllowList.js.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -0
- package/dist/AllowLists/SimpleAllowList.js +1 -0
- package/dist/AllowLists/SimpleAllowList.js.map +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs +1 -0
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -0
- package/dist/AllowLists/SimpleDenyList.js +1 -0
- package/dist/AllowLists/SimpleDenyList.js.map +1 -0
- package/dist/Auth/Auth.cjs +1 -0
- package/dist/Auth/Auth.cjs.map +1 -0
- package/dist/Auth/Auth.js +1 -0
- package/dist/Auth/Auth.js.map +1 -0
- package/dist/Auth/PassthroughAuth.cjs +1 -0
- package/dist/Auth/PassthroughAuth.cjs.map +1 -0
- package/dist/Auth/PassthroughAuth.js +1 -0
- package/dist/Auth/PassthroughAuth.js.map +1 -0
- package/dist/Boost.cjs +1 -0
- package/dist/Boost.cjs.map +1 -0
- package/dist/Boost.js +1 -0
- package/dist/Boost.js.map +1 -0
- package/dist/BoostCore.cjs +1 -0
- package/dist/BoostCore.cjs.map +1 -0
- package/dist/BoostCore.js +1 -0
- package/dist/BoostCore.js.map +1 -0
- package/dist/BoostRegistry.cjs +1 -0
- package/dist/BoostRegistry.cjs.map +1 -0
- package/dist/BoostRegistry.js +1 -0
- package/dist/BoostRegistry.js.map +1 -0
- package/dist/Budgets/Budget.cjs +2 -1
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.d.ts +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +14 -12
- package/dist/Budgets/Budget.js.map +1 -0
- package/dist/Budgets/ManagedBudget.cjs +1 -0
- package/dist/Budgets/ManagedBudget.cjs.map +1 -0
- package/dist/Budgets/ManagedBudget.js +1 -0
- package/dist/Budgets/ManagedBudget.js.map +1 -0
- package/dist/Deployable/Contract.cjs +1 -0
- package/dist/Deployable/Contract.cjs.map +1 -0
- package/dist/Deployable/Contract.js +1 -0
- package/dist/Deployable/Contract.js.map +1 -0
- package/dist/Deployable/Deployable.cjs +1 -0
- package/dist/Deployable/Deployable.cjs.map +1 -0
- package/dist/Deployable/Deployable.js +1 -0
- package/dist/Deployable/Deployable.js.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +1 -0
- package/dist/Deployable/DeployableTarget.cjs.map +1 -0
- package/dist/Deployable/DeployableTarget.js +1 -0
- package/dist/Deployable/DeployableTarget.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -0
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.js +1 -0
- package/dist/Incentives/AllowListIncentive.js.map +1 -0
- package/dist/Incentives/CGDAIncentive.cjs +1 -0
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -0
- package/dist/Incentives/CGDAIncentive.js +1 -0
- package/dist/Incentives/CGDAIncentive.js.map +1 -0
- package/dist/Incentives/ERC20Incentive.cjs +1 -0
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -0
- package/dist/Incentives/ERC20Incentive.js +1 -0
- package/dist/Incentives/ERC20Incentive.js.map +1 -0
- package/dist/Incentives/Incentive.cjs +2 -1
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.d.ts +1 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +39 -36
- package/dist/Incentives/Incentive.js.map +1 -0
- package/dist/Incentives/PointsIncentive.cjs +1 -0
- package/dist/Incentives/PointsIncentive.cjs.map +1 -0
- package/dist/Incentives/PointsIncentive.js +1 -0
- package/dist/Incentives/PointsIncentive.js.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -0
- package/dist/Validators/SignerValidator.cjs.map +1 -0
- package/dist/Validators/SignerValidator.js +1 -0
- package/dist/Validators/SignerValidator.js.map +1 -0
- package/dist/Validators/Validator.cjs +2 -1
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.d.ts +1 -1
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +9 -7
- package/dist/Validators/Validator.js.map +1 -0
- package/dist/componentInterfaces-CKCBwG16.cjs +2 -0
- package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
- package/dist/componentInterfaces-DYkaxBda.js +13 -0
- package/dist/componentInterfaces-DYkaxBda.js.map +1 -0
- package/dist/errors.cjs +1 -0
- package/dist/errors.cjs.map +1 -0
- package/dist/errors.js +1 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated-Cd-Fe7W7.cjs +1 -0
- package/dist/generated-Cd-Fe7W7.cjs.map +1 -0
- package/dist/generated-DGpIVcv5.js +1 -0
- package/dist/generated-DGpIVcv5.js.map +1 -0
- package/dist/index.cjs +1 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -0
- package/dist/utils.cjs +1 -0
- package/dist/utils.cjs.map +1 -0
- package/dist/utils.d.ts +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +1 -0
- package/dist/utils.js.map +1 -0
- package/package.json +5 -3
- package/src/Actions/Action.test.ts +77 -0
- package/src/Actions/Action.ts +61 -0
- package/src/Actions/ContractAction.test.ts +199 -0
- package/src/Actions/ContractAction.ts +238 -0
- package/src/Actions/ERC721MintAction.test.ts +112 -0
- package/src/Actions/ERC721MintAction.ts +238 -0
- package/src/Actions/EventAction.test.ts +182 -0
- package/src/Actions/EventAction.ts +382 -0
- package/src/AllowLists/AllowList.test.ts +64 -0
- package/src/AllowLists/AllowList.ts +60 -0
- package/src/AllowLists/SimpleAllowList.test.ts +52 -0
- package/src/AllowLists/SimpleAllowList.ts +240 -0
- package/src/AllowLists/SimpleDenyList.test.ts +52 -0
- package/src/AllowLists/SimpleDenyList.ts +289 -0
- package/src/Auth/Auth.ts +11 -0
- package/src/Auth/PassthroughAuth.test.ts +12 -0
- package/src/Auth/PassthroughAuth.ts +80 -0
- package/src/Boost.ts +155 -0
- package/src/BoostCore.test.ts +846 -0
- package/src/BoostCore.ts +1192 -0
- package/src/BoostRegistry.ts +449 -0
- package/src/Budgets/Budget.test.ts +27 -0
- package/src/Budgets/Budget.ts +61 -0
- package/src/Budgets/ManagedBudget.test.ts +154 -0
- package/src/Budgets/ManagedBudget.ts +743 -0
- package/src/Budgets/SimpleBudget.test.ts +152 -0
- package/src/Budgets/SimpleBudget.ts +521 -0
- package/src/Budgets/VestingBudget.test.ts +123 -0
- package/src/Budgets/VestingBudget.ts +532 -0
- package/src/Deployable/Contract.ts +229 -0
- package/src/Deployable/Deployable.ts +244 -0
- package/src/Deployable/DeployableTarget.ts +210 -0
- package/src/Incentives/AllowListIncentive.test.ts +146 -0
- package/src/Incentives/AllowListIncentive.ts +290 -0
- package/src/Incentives/CGDAIncentive.test.ts +136 -0
- package/src/Incentives/CGDAIncentive.ts +364 -0
- package/src/Incentives/ERC1155Incentive.test.ts +98 -0
- package/src/Incentives/ERC1155Incentive.ts +384 -0
- package/src/Incentives/ERC20Incentive.test.ts +141 -0
- package/src/Incentives/ERC20Incentive.ts +417 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +156 -0
- package/src/Incentives/ERC20VariableIncentive.ts +368 -0
- package/src/Incentives/Incentive.test.ts +92 -0
- package/src/Incentives/Incentive.ts +85 -0
- package/src/Incentives/PointsIncentive.test.ts +142 -0
- package/src/Incentives/PointsIncentive.ts +303 -0
- package/src/Validators/SignerValidator.test.ts +163 -0
- package/src/Validators/SignerValidator.ts +272 -0
- package/src/Validators/Validator.test.ts +21 -0
- package/src/Validators/Validator.ts +55 -0
- package/src/errors.ts +524 -0
- package/src/index.test.ts +40 -0
- package/src/index.ts +50 -0
- package/src/utils.test.ts +44 -0
- package/src/utils.ts +2247 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTarget.cjs","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface as readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Address}\n */\n static readonly base: Address = zeroAddress;\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly isBase: boolean = true;\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n if (isBase !== undefined) this.isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static address\n *\n * @public\n * @readonly\n * @type {Address}\n */\n public get base(): Address {\n return (this.constructor as typeof DeployableTarget).base;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {unknown}\n */\n public override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n public override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]\n * @returns {unknown} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\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 args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]\n * @returns {unknown}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\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 args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","zeroAddress","RegistryType","DeployableTarget"],"mappings":"2PAkCaA,EAAN,MAAMA,UAGHC,EAAAA,UAAiC,CAiCzC,YACEC,EACAC,EACAC,EACA,CACA,MAAMF,EAASC,CAAO,EAfxB,KAAS,OAAkB,GAgBrBC,IAAW,SAAW,KAAK,OAASA,EAC1C,CASA,IAAW,MAAgB,CACzB,OAAQ,KAAK,YAAwC,IACvD,CASA,IAAW,cAA6B,CACtC,OAAQ,KAAK,YAAwC,YACvD,CAYA,MAAsB,OACpBD,EACAD,EACAG,EACA,CACA,aAAM,MAAM,OAAOF,EAASD,EAASG,CAAU,EAC/C,KAAK,mBAAmB,EACjB,IACT,CAWA,MAAsB,UACpBC,EACAC,EACe,CACf,GAAI,KAAK,QAAe,MAAA,IAAIC,EAA+B,+BAAA,KAAK,OAAO,EACjE,MAAAL,EAAUG,GAAY,KAAK,SAC3BG,GAASF,GAAA,YAAAA,EAAU,SAAU,KAAK,QAClC,CAAE,KAAAG,EAAM,GAAGC,GAAe,KAAK,gBAAgBR,CAAO,EACrD,OAAA,MAAMS,iBAAeH,EAAQ,CAClC,GAAGE,EACH,GAAG,KAAK,wBAAwBJ,GAAA,YAAAA,EAAU,OAAO,EAEjD,KAAM,CAAC,CAAA,CACR,CACH,CAWA,MAAa,kBACXM,EACAC,EACA,CACO,OAAAC,EAAA,GAAgC,KAAK,QAAS,CACnD,QAAS,KAAK,mBAAmB,EACjC,GAAG,KAAK,wBAAwB,EAEhC,GAAID,EACJ,KAAM,CAACD,CAAW,CAAA,CACnB,CACH,CAWA,MAAa,sBACXC,EACA,CACO,OAAAE,EAAA,GAAoC,KAAK,QAAS,CACvD,QAAS,KAAK,mBAAmB,EACjC,GAAG,KAAK,wBAAwB,EAEhC,GAAIF,EACJ,KAAM,CAAC,CAAA,CACR,CACH,CAWmB,yBACjBR,EACAC,EACA,CACM,MAAAJ,EAAUG,GAAY,KAAK,SACjC,GAAI,CAACH,EAAS,MAAM,IAAIc,EAA8B,8BAC/C,OAAA,MAAM,yBAAyBd,EAASI,CAAQ,CAIzD,CACF,EApKEP,EAAgB,KAAgBkB,cAQhClB,EAAgB,aAA6BmB,EAAa,aAAA,OAnBrD,IAAMC,EAANpB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTarget.js","sources":["../../src/Deployable/DeployableTarget.ts"],"sourcesContent":["import {\n type aCloneableAbi,\n readACloneableGetComponentInterface as readACloneableGetComponentInterface,\n readACloneableSupportsInterface,\n} from '@boostxyz/evm';\nimport { deployContract } from '@wagmi/core';\nimport {\n type Abi,\n type Address,\n type Hash,\n type Hex,\n type WaitForTransactionReceiptParameters,\n zeroAddress,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableMissingPayloadError,\n} from '../errors';\nimport { type ReadParams, RegistryType } from '../utils';\nimport {\n Deployable,\n type DeployableOptions,\n type DeployablePayloadOrAddress,\n} from './Deployable';\n\n/**\n * A base class representing a generic base Boost Protocol target contract, extended by Actions, AllowLists, Budgets, Incentives, and Validators.\n *\n * @export\n * @class DeployableTarget\n * @typedef {DeployableTarget}\n * @template [Payload=unknown]\n * @extends {Deployable<Payload>}\n */\nexport class DeployableTarget<\n Payload,\n ContractAbi extends Abi,\n> extends Deployable<Payload, ContractAbi> {\n /**\n * A static property representing the address of the base implementation on chain, used when cloning base contracts.\n *\n * @static\n * @readonly\n * @type {Address}\n */\n static readonly base: Address = zeroAddress;\n /**\n * The target's registry type.\n *\n * @static\n * @readonly\n * @type {RegistryType}\n */\n static readonly registryType: RegistryType = RegistryType.ACTION;\n /**\n * A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n *\n * @readonly\n * @type {boolean}\n */\n readonly isBase: boolean = true;\n\n /**\n * Creates an instance of DeployableTarget.\n *\n * @constructor\n * @param {DeployableOptions} options\n * @param {DeployablePayloadOrAddress<Payload>} payload - Either a given implementation's initialization payload, or an address to an existing on chain target.\n * @param {?boolean} [isBase] - A property asserting that the protocol should eiher clone and initialize a new target from the base implementation, or re-use an existing contract without initializing.\n */\n constructor(\n options: DeployableOptions,\n payload: DeployablePayloadOrAddress<Payload>,\n isBase?: boolean,\n ) {\n super(options, payload);\n if (isBase !== undefined) this.isBase = isBase;\n }\n\n /**\n * A getter that will return the base implementation's static address\n *\n * @public\n * @readonly\n * @type {Address}\n */\n public get base(): Address {\n return (this.constructor as typeof DeployableTarget).base;\n }\n\n /**\n * A getter that returns the registry type of the base implementation\n *\n * @public\n * @readonly\n * @type {RegistryType}\n */\n public get registryType(): RegistryType {\n return (this.constructor as typeof DeployableTarget).registryType;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [payload]\n * @param {?DeployableOptions} [options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {unknown}\n */\n public override async deploy(\n payload?: Payload,\n options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n await super.deploy(payload, options, waitParams);\n this.assertValidAddress();\n return this;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n */\n public override async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const payload = _payload || this._payload;\n const config = _options?.config || this._config;\n const { args, ...deployment } = this.buildParameters(payload);\n return await deployContract(config, {\n ...deployment,\n ...this.optionallyAttachAccount(_options?.account),\n // Deployable targets don't construct with arguments, they initialize with encoded payloads\n args: [],\n });\n }\n\n /**\n * Check if the contract supports the given interface\n *\n * @public\n * @async\n * @param {Hex} interfaceId - The interface identifier\n * @param {?ReadParams<typeof contractActionAbi, 'supportsInterface'>} [params]\n * @returns {unknown} - True if the contract supports the interface\n */\n public async supportsInterface(\n interfaceId: Hex,\n params?: ReadParams<typeof aCloneableAbi, 'supportsInterface'>,\n ) {\n return readACloneableSupportsInterface(this._config, {\n address: this.assertValidAddress(),\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 args: [interfaceId],\n });\n }\n\n /**\n * Return a cloneable's unique identifier for downstream consumers to differentiate various targets\n * All implementations must override this function\n *\n * @public\n * @async\n * @param {?ReadParams<typeof contractActionAbi, 'getComponentInterface'>} [params]\n * @returns {unknown}\n */\n public async getComponentInterface(\n params?: ReadParams<typeof aCloneableAbi, 'getComponentInterface'>,\n ) {\n return readACloneableGetComponentInterface(this._config, {\n address: this.assertValidAddress(),\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 args: [],\n });\n }\n\n /**\n * @inheritdoc\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n */\n protected override validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const payload = _payload || this._payload;\n if (!payload) throw new DeployableMissingPayloadError();\n return super.validateDeploymentConfig(payload, _options) as [\n P,\n DeployableOptions,\n ];\n }\n}\n"],"names":["_DeployableTarget","Deployable","options","payload","isBase","waitParams","_payload","_options","DeployableAlreadyDeployedError","config","args","deployment","deployContract","interfaceId","params","readACloneableSupportsInterface","readACloneableGetComponentInterface","DeployableMissingPayloadError","zeroAddress","RegistryType","DeployableTarget"],"mappings":";;;;;;AAkCO,MAAMA,IAAN,MAAMA,UAGHC,EAAiC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAiCzC,YACEC,GACAC,GACAC,GACA;AACA,UAAMF,GAASC,CAAO,GAfxB,KAAS,SAAkB,IAgBrBC,MAAW,WAAW,KAAK,SAASA;AAAA,EAC1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AK,SAAS;AAAA,MACvD,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIF;AAAA,MACJ,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWmB,yBACjBR,GACAC,GACA;AACM,UAAAJ,IAAUG,KAAY,KAAK;AACjC,QAAI,CAACH;AAAS,YAAM,IAAIc,EAA8B;AAC/C,WAAA,MAAM,yBAAyBd,GAASI,CAAQ;AAAA,EAIzD;AACF;AApKEP,EAAgB,OAAgBkB,GAQhClB,EAAgB,eAA6BmB,EAAa;AAnBrD,IAAMC,IAANpB;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../generated-Cd-Fe7W7.cjs");require("@wagmi/core");require("viem");const r=require("../AllowLists/SimpleAllowList.cjs");require("../AllowLists/SimpleDenyList.cjs");const i=require("../Deployable/DeployableTarget.cjs"),a=require("../utils.cjs"),n="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611791806100bd5f395ff3fe60806040526004361061011e575f3560e01c806387b9d25c1161009f578063db09da1211610063578063db09da1214610390578063dcc59b6f146103cc578063f04e283e146103f6578063f2fde38b14610412578063fee81cf41461042e5761011e565b806387b9d25c1461029a5780638da5cb5b146102c4578063a4d66daf146102ee578063bb1757cf14610318578063c884ef83146103545761011e565b8063439fab91116100e6578063439fab91146101e6578063474f5a441461020e5780634e7165a21461024a57806354d1f13d14610286578063715018a6146102905761011e565b806301ffc9a71461012257806307621eca1461015e578063228cb7331461018857806325692962146101b257806328d6183b146101bc575b5f80fd5b34801561012d575f80fd5b5061014860048036038101906101439190610fa9565b61046a565b6040516101559190610fee565b60405180910390f35b348015610169575f80fd5b506101726104e3565b60405161017f919061101f565b60405180910390f35b348015610193575f80fd5b5061019c6104ec565b6040516101a9919061101f565b60405180910390f35b6101ba6104f2565b005b3480156101c7575f80fd5b506101d0610543565b6040516101dd9190611047565b60405180910390f35b3480156101f1575f80fd5b5061020c600480360381019061020791906110c1565b61056a565b005b348015610219575f80fd5b50610234600480360381019061022f91906110c1565b61064a565b6040516102419190610fee565b60405180910390f35b348015610255575f80fd5b50610270600480360381019061026b91906110c1565b61067d565b60405161027d919061117c565b60405180910390f35b61028e6106d4565b005b61029861070d565b005b3480156102a5575f80fd5b506102ae610720565b6040516102bb9190611216565b60405180910390f35b3480156102cf575f80fd5b506102d8610745565b6040516102e5919061124f565b60405180910390f35b3480156102f9575f80fd5b5061030261076d565b60405161030f919061101f565b60405180910390f35b348015610323575f80fd5b5061033e60048036038101906103399190611292565b610773565b60405161034b9190610fee565b60405180910390f35b34801561035f575f80fd5b5061037a600480360381019061037591906112ef565b610918565b6040516103879190610fee565b60405180910390f35b34801561039b575f80fd5b506103b660048036038101906103b19190611292565b610935565b6040516103c39190610fee565b60405180910390f35b3480156103d7575f80fd5b506103e0610a3a565b6040516103ed919061101f565b60405180910390f35b610410600480360381019061040b91906112ef565b610a3f565b005b61042c600480360381019061042791906112ef565b610a7d565b005b348015610439575f80fd5b50610454600480360381019061044f91906112ef565b610aa6565b604051610461919061101f565b60405180910390f35b5f7f0a466e6f000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806104dc57506104db82610abf565b5b9050919050565b5f600154905090565b60015481565b5f6104fb610b38565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f0a466e6f00000000000000000000000000000000000000000000000000000000905090565b5f610573610b42565b905080546003825580156105a55760018160011c14303b1061059c5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f83838101906105b69190611448565b90506105c133610b6b565b805f015160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060200151600481905550508015610645576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f6040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60605f67ffffffffffffffff8111156106995761069861131e565b5b6040519080825280601f01601f1916602001820160405280156106cb5781602001600182028036833780820191505090505b50905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610715610c41565b61071e5f610c78565b565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b5f61077c610c41565b6004545f80815480929190610790906114a0565b919050551015806107e7575060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b1561081e576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160025f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f8061087e86610d3e565b9150915060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633abb060483836040518363ffffffff1660e01b81526004016108de929190611655565b5f604051808303815f87803b1580156108f5575f80fd5b505af1158015610907573d5f803e3d5ffd5b505050506001925050509392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b5f6004545f5410801561098f575060025f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015610a31575060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3f756de856040518263ffffffff1660e01b81526004016109f091906116ad565b602060405180830381865afa158015610a0b573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a2f9190611703565b155b90509392505050565b5f5481565b610a47610c41565b63389a75e1600c52805f526020600c208054421115610a6d57636f5e88185f526004601cfd5b5f815550610a7a81610c78565b50565b610a85610c41565b8060601b610a9a57637448fbae5f526004601cfd5b610aa381610c78565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b315750610b3082610e5d565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610b73610ed6565b15610beb577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610bad57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c3e565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610c76576382b429005f526004601cfd5b565b610c80610ed6565b15610ce5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610d3b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060805f600167ffffffffffffffff811115610d5d57610d5c61131e565b5b604051908082528060200260200182016040528015610d8b5781602001602082028036833780820191505090505b5090505f600167ffffffffffffffff811115610daa57610da961131e565b5b604051908082528060200260200182016040528015610dd85781602001602082028036833780820191505090505b50905084825f81518110610def57610dee61172e565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001815f81518110610e3e57610e3d61172e565b5b6020026020010190151590811515815250508181935093505050915091565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610ecf5750610ece82610eda565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610f8881610f54565b8114610f92575f80fd5b50565b5f81359050610fa381610f7f565b92915050565b5f60208284031215610fbe57610fbd610f4c565b5b5f610fcb84828501610f95565b91505092915050565b5f8115159050919050565b610fe881610fd4565b82525050565b5f6020820190506110015f830184610fdf565b92915050565b5f819050919050565b61101981611007565b82525050565b5f6020820190506110325f830184611010565b92915050565b61104181610f54565b82525050565b5f60208201905061105a5f830184611038565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261108157611080611060565b5b8235905067ffffffffffffffff81111561109e5761109d611064565b5b6020830191508360018202830111156110ba576110b9611068565b5b9250929050565b5f80602083850312156110d7576110d6610f4c565b5b5f83013567ffffffffffffffff8111156110f4576110f3610f50565b5b6111008582860161106c565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61114e8261110c565b6111588185611116565b9350611168818560208601611126565b61117181611134565b840191505092915050565b5f6020820190508181035f8301526111948184611144565b905092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f6111de6111d96111d48461119c565b6111bb565b61119c565b9050919050565b5f6111ef826111c4565b9050919050565b5f611200826111e5565b9050919050565b611210816111f6565b82525050565b5f6020820190506112295f830184611207565b92915050565b5f6112398261119c565b9050919050565b6112498161122f565b82525050565b5f6020820190506112625f830184611240565b92915050565b6112718161122f565b811461127b575f80fd5b50565b5f8135905061128c81611268565b92915050565b5f805f604084860312156112a9576112a8610f4c565b5b5f6112b68682870161127e565b935050602084013567ffffffffffffffff8111156112d7576112d6610f50565b5b6112e38682870161106c565b92509250509250925092565b5f6020828403121561130457611303610f4c565b5b5f6113118482850161127e565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61135482611134565b810181811067ffffffffffffffff821117156113735761137261131e565b5b80604052505050565b5f611385610f43565b9050611391828261134b565b919050565b5f6113a08261122f565b9050919050565b6113b081611396565b81146113ba575f80fd5b50565b5f813590506113cb816113a7565b92915050565b6113da81611007565b81146113e4575f80fd5b50565b5f813590506113f5816113d1565b92915050565b5f604082840312156114105761140f61131a565b5b61141a604061137c565b90505f611429848285016113bd565b5f83015250602061143c848285016113e7565b60208301525092915050565b5f6040828403121561145d5761145c610f4c565b5b5f61146a848285016113fb565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6114aa82611007565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036114dc576114db611473565b5b600182019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6115198161122f565b82525050565b5f61152a8383611510565b60208301905092915050565b5f602082019050919050565b5f61154c826114e7565b61155681856114f1565b935061156183611501565b805f5b83811015611591578151611578888261151f565b975061158383611536565b925050600181019050611564565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b6115d081610fd4565b82525050565b5f6115e183836115c7565b60208301905092915050565b5f602082019050919050565b5f6116038261159e565b61160d81856115a8565b9350611618836115b8565b805f5b8381101561164857815161162f88826115d6565b975061163a836115ed565b92505060018101905061161b565b5085935050505092915050565b5f6040820190508181035f83015261166d8185611542565b9050818103602083015261168181846115f9565b90509392505050565b50565b5f6116985f83611116565b91506116a38261168a565b5f82019050919050565b5f6040820190506116c05f830184611240565b81810360208301526116d18161168d565b905092915050565b6116e281610fd4565b81146116ec575f80fd5b50565b5f815190506116fd816116d9565b92915050565b5f6020828403121561171857611717610f4c565b5b5f611725848285016116ef565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea26469706673582212208bc630e11c065de18b61496283ea93bb882211261a2de5178b91a410f78a5c9a64736f6c634300081a0033",d=class d extends i.DeployableTarget{constructor(){super(...arguments),this.abi=b.A}async owner(f){return b.ju(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return b.Pu(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return b.Ju(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,e){return b.Du(this._config,{address:this.assertValidAddress(),args:[f],...e})}async allowList(f){const e=await b.ku(this._config,{address:this.assertValidAddress(),...f});return new r.SimpleAllowList({config:this._config,account:this._account},e)}async limit(f){return b.$u(this._config,{address:this.assertValidAddress(),...f})}async claim(f,e){return this.awaitResult(this.claimRaw(f,e))}async claimRaw(f,e){const{request:c,result:s}=await b.pl(this._config,{address:this.assertValidAddress(),args:[a.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...e});return{hash:await b.el(this._config,c),result:s}}async isClaimable(f,e){return b.Zu(this._config,{address:this.assertValidAddress(),args:[a.prepareClaimPayload(f)],...e})}buildParameters(f,e){const[c,s]=this.validateDeploymentConfig(f,e);return{abi:b.A,bytecode:n,args:[a.prepareAllowListIncentivePayload(c)],...this.optionallyAttachAccount(s.account)}}};d.base="0x5Cd43Ea5541e1D6FF36962E6e6C11f0bf9d573d4",d.registryType=a.RegistryType.INCENTIVE;let t=d;exports.allowListIncentiveAbi=b.A;exports.AllowListIncentive=t;
|
|
2
|
+
//# sourceMappingURL=AllowListIncentive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowListIncentive.cjs","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type AllowListIncentivePayload,\n type ClaimPayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareAllowListIncentivePayload,\n prepareClaimPayload,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\nexport type { AllowListIncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ALLOWLIST_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(\n params?: ReadParams<typeof allowListIncentiveAbi, 'owner'>,\n ) {\n return readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof allowListIncentiveAbi, 'claims'>,\n ) {\n return readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof allowListIncentiveAbi, 'reward'>,\n ) {\n return readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof allowListIncentiveAbi, 'claimed'>,\n ) {\n return readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'allowList'>} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(\n params?: ReadParams<typeof allowListIncentiveAbi, 'allowList'>,\n ): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(\n params?: ReadParams<typeof allowListIncentiveAbi, 'limit'>,\n ) {\n return readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n public async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n public async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'isClaimable'>} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams<typeof allowListIncentiveAbi, 'isClaimable'>,\n ) {\n return readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","RegistryType","AllowListIncentive"],"mappings":"w/YA6DaA,EAAN,MAAMA,UAA2BC,EAAAA,gBAGtC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA2B/B,MAAa,MACXC,EACA,CACO,OAAAC,EAAA,GAA4B,KAAK,QAAS,CAC/C,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,OACXA,EACA,CACO,OAAAE,EAAA,GAA6B,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OACXA,EACA,CACO,OAAAG,EAAA,GAA6B,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAWA,MAAa,QACXI,EACAJ,EACA,CACO,OAAAK,EAAA,GAA8B,KAAK,QAAS,CACjD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EAEd,GAAIJ,CAAA,CACL,CACH,CAUA,MAAa,UACXA,EAC0B,CAC1B,MAAMI,EAAU,MAAME,KAAgC,KAAK,QAAS,CAClE,QAAS,KAAK,mBAAmB,EAEjC,GAAIN,CAAA,CACL,EACD,OAAO,IAAIO,EAAA,gBACT,CAAE,OAAQ,KAAK,QAAS,QAAS,KAAK,QAAS,EAC/CH,CAAA,CAEJ,CAUA,MAAa,MACXJ,EACA,CACO,OAAAQ,EAAA,GAA4B,KAAK,QAAS,CAC/C,QAAS,KAAK,mBAAmB,EAEjC,GAAIR,CAAA,CACL,CACH,CAWA,MAAa,MACXS,EACAT,EACA,CACA,OAAO,KAAK,YAAY,KAAK,SAASS,EAAST,CAAM,CAAC,CACxD,CAWA,MAAa,SACXS,EACAT,EACA,CACA,KAAM,CAAE,QAAAU,EAAS,OAAAC,CAAO,EAAI,MAAMC,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACC,sBAAoBJ,CAAO,CAAC,EACnC,GAAG,KAAK,wBAAwB,EAEhC,GAAIT,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMc,EAA6B,GAAA,KAAK,QAASJ,CAAO,EACtD,OAAAC,EACjB,CAWA,MAAa,YACXF,EACAT,EACA,CACO,OAAAe,EAAA,GAAkC,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,sBAAoBJ,CAAO,CAAC,EAEnC,GAAIT,CAAA,CACL,CACH,CAUgB,gBACdgB,EACAC,EACyB,CACzB,KAAM,CAACR,EAASS,CAAO,EAAI,KAAK,yBAC9BF,EACAC,CAAA,EAEK,MAAA,CACL,IAAKlB,EAAA,EACL,SAAAoB,EACA,KAAM,CAACC,mCAAiCX,CAAO,CAAC,EAChD,GAAG,KAAK,wBAAwBS,EAAQ,OAAO,CAAA,CAEnD,CACF,EAxNyBrB,EAAA,KAAgB,6CASvCA,EAAuB,aAA6BwB,EAAa,aAAA,UArB5D,IAAMC,EAANzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllowListIncentive.js","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type AllowListIncentivePayload,\n type ClaimPayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareAllowListIncentivePayload,\n prepareClaimPayload,\n} from '../utils';\n\nexport { allowListIncentiveAbi };\nexport type { AllowListIncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ALLOWLIST_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the allowList\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(\n params?: ReadParams<typeof allowListIncentiveAbi, 'owner'>,\n ) {\n return readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof allowListIncentiveAbi, 'claims'>,\n ) {\n return readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof allowListIncentiveAbi, 'reward'>,\n ) {\n return readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof allowListIncentiveAbi, 'claimed'>,\n ) {\n return readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'allowList'>} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(\n params?: ReadParams<typeof allowListIncentiveAbi, 'allowList'>,\n ): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(\n params?: ReadParams<typeof allowListIncentiveAbi, 'limit'>,\n ) {\n return readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n public async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams<typeof allowListIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n public async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams<typeof allowListIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'isClaimable'>} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams<typeof allowListIncentiveAbi, 'isClaimable'>,\n ) {\n return readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","RegistryType","AllowListIncentive"],"mappings":";;;;;;;4qYA6DaA,IAAN,MAAMA,UAA2BC,EAGtC;AAAA,EAHK,cAAA;AAAA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KlB;AAAAA,MACL,UAAAoB;AAAA,MACA,MAAM,CAACC,EAAiCX,CAAO,CAAC;AAAA,MAChD,GAAG,KAAK,wBAAwBS,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AACF;AAxNyBrB,EAAA,OAAgB,8CASvCA,EAAuB,eAA6BwB,EAAa;AArB5D,IAAMC,IAANzB;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../generated-Cd-Fe7W7.cjs"),i=require("../Deployable/DeployableTarget.cjs"),c=require("../utils.cjs"),n="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611cb4806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063c884ef831161006e578063c884ef831461038c578063db09da12146103c8578063dcc59b6f14610404578063f04e283e1461042e578063f2fde38b1461044a578063fee81cf41461046657610129565b8063715018a6146102c557806375ef18d0146102cf5780638da5cb5b146102fc578063bb1757cf14610326578063c78da39a1461036257610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461027f57806354d1f13d146102bb57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190611267565b6104a2565b60405161016091906112ac565b60405180910390f35b348015610174575f80fd5b5061017d61051b565b60405161018a91906112dd565b60405180910390f35b34801561019e575f80fd5b506101a76105c5565b6040516101b491906112dd565b60405180910390f35b6101c56105cb565b005b3480156101d2575f80fd5b506101db61061c565b6040516101e89190611305565b60405180910390f35b3480156101fc575f80fd5b50610205610643565b604051610212919061135d565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c91906113d7565b610668565b005b34801561024e575f80fd5b50610269600480360381019061026491906113d7565b610890565b60405161027691906112ac565b60405180910390f35b34801561028a575f80fd5b506102a560048036038101906102a091906113d7565b6109b9565b6040516102b29190611492565b60405180910390f35b6102c3610a89565b005b6102cd610ac2565b005b3480156102da575f80fd5b506102e3610ad5565b6040516102f394939291906114b2565b60405180910390f35b348015610307575f80fd5b50610310610af2565b60405161031d919061135d565b60405180910390f35b348015610331575f80fd5b5061034c6004803603810190610347919061151f565b610b1a565b60405161035991906112ac565b60405180910390f35b34801561036d575f80fd5b50610376610ca6565b60405161038391906112dd565b60405180910390f35b348015610397575f80fd5b506103b260048036038101906103ad919061157c565b610cac565b6040516103bf91906112ac565b60405180910390f35b3480156103d3575f80fd5b506103ee60048036038101906103e9919061151f565b610cc9565b6040516103fb91906112ac565b60405180910390f35b34801561040f575f80fd5b50610418610cdc565b60405161042591906112dd565b60405180910390f35b6104486004803603810190610443919061157c565b610ce1565b005b610464600480360381019061045f919061157c565b610d1f565b005b348015610471575f80fd5b5061048c6004803603810190610487919061157c565b610d48565b60405161049991906112dd565b60405180910390f35b5f7fa39e44d9000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610514575061051382610d61565b5b9050919050565b5f806004600201544261052e91906115d4565b90505f61057b3060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dda90919063ffffffff16565b90505f610e10600460010154846105929190611607565b61059c9190611675565b6004600301546105ac91906116a5565b90508181116105bb57806105bd565b815b935050505090565b60015481565b5f6105d4610e0d565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fa39e44d900000000000000000000000000000000000000000000000000000000905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f610671610e17565b905080546003825580156106a35760018160011c14303b1061069a5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f83838101906106b4919061180b565b90505f6106e330835f015173ffffffffffffffffffffffffffffffffffffffff16610dda90919063ffffffff16565b9050816080015181101561073957815f01518183608001516040517f5c54305e00000000000000000000000000000000000000000000000000000000815260040161073093929190611836565b60405180910390fd5b5f8260200151148061074e57505f8260400151145b8061075c57505f8260600151145b8061076e575081602001518260800151105b156107a5576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f015160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180608001604052808360400151815260200183606001518152602001428152602001836020015181525060045f820151815f0155602082015181600101556040820151816002015560608201518160030155905050816080015160088190555061085433610e40565b5050801561088b576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f610899610f16565b5f83838101906108a99190611984565b90505f81602001518060200190518101906108c491906119df565b9050610915825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4d9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f01518460405160200161098993929190611a6f565b6040516020818303038152906040526040516109a59190611492565b60405180910390a260019250505092915050565b60605f83838101906109cb919061180b565b90506040518060800160405280600160028111156109ec576109eb611aab565b5b8152602001825f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808460800151815250604051602001610a4f9190611b01565b604051602081830303815290604052815250604051602001610a719190611c17565b60405160208183030381529060405291505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610aca610f16565b610ad35f610f96565b565b6004805f0154908060010154908060020154908060030154905084565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f610b23610f16565b610b2c8461105c565b610b62576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f80815480929190610b7390611c37565b91905055505f610b8161051b565b90504260046002018190555060045f01548111610ba25760045f0154610bb3565b60045f015481610bb291906115d4565b5b600460030181905550610c08858260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610f4d9092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168784604051602001610c7693929190611a6f565b604051602081830303815290604052604051610c929190611492565b60405180910390a260019150509392505050565b60085481565b6002602052805f5260405f205f915054906101000a900460ff1681565b5f610cd38461105c565b90509392505050565b5f5481565b610ce9610f16565b63389a75e1600c52805f526020600c208054421115610d0f57636f5e88185f526004601cfd5b5f815550610d1c81610f96565b50565b610d27610f16565b8060601b610d3c57637448fbae5f526004601cfd5b610d4581610f96565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610dd35750610dd28261111b565b5b9050919050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610e48611194565b15610ec0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610e8257630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610f13565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610f4b576382b429005f526004601cfd5b565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716610f8d576390b8ec185f526004601cfd5b5f603452505050565b610f9e611194565b15611003577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550611059565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f8061106661051b565b90505f811180156110c05750806110bd3060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610dda90919063ffffffff16565b10155b8015611113575060025f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b915050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061118d575061118c82611198565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61124681611212565b8114611250575f80fd5b50565b5f813590506112618161123d565b92915050565b5f6020828403121561127c5761127b61120a565b5b5f61128984828501611253565b91505092915050565b5f8115159050919050565b6112a681611292565b82525050565b5f6020820190506112bf5f83018461129d565b92915050565b5f819050919050565b6112d7816112c5565b82525050565b5f6020820190506112f05f8301846112ce565b92915050565b6112ff81611212565b82525050565b5f6020820190506113185f8301846112f6565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6113478261131e565b9050919050565b6113578161133d565b82525050565b5f6020820190506113705f83018461134e565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261139757611396611376565b5b8235905067ffffffffffffffff8111156113b4576113b361137a565b5b6020830191508360018202830111156113d0576113cf61137e565b5b9250929050565b5f80602083850312156113ed576113ec61120a565b5b5f83013567ffffffffffffffff81111561140a5761140961120e565b5b61141685828601611382565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61146482611422565b61146e818561142c565b935061147e81856020860161143c565b6114878161144a565b840191505092915050565b5f6020820190508181035f8301526114aa818461145a565b905092915050565b5f6080820190506114c55f8301876112ce565b6114d260208301866112ce565b6114df60408301856112ce565b6114ec60608301846112ce565b95945050505050565b6114fe8161133d565b8114611508575f80fd5b50565b5f81359050611519816114f5565b92915050565b5f805f604084860312156115365761153561120a565b5b5f6115438682870161150b565b935050602084013567ffffffffffffffff8111156115645761156361120e565b5b61157086828701611382565b92509250509250925092565b5f602082840312156115915761159061120a565b5b5f61159e8482850161150b565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6115de826112c5565b91506115e9836112c5565b9250828203905081811115611601576116006115a7565b5b92915050565b5f611611826112c5565b915061161c836112c5565b925082820261162a816112c5565b91508282048414831517611641576116406115a7565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61167f826112c5565b915061168a836112c5565b92508261169a57611699611648565b5b828204905092915050565b5f6116af826112c5565b91506116ba836112c5565b92508282019050808211156116d2576116d16115a7565b5b92915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6117128261144a565b810181811067ffffffffffffffff82111715611731576117306116dc565b5b80604052505050565b5f611743611201565b905061174f8282611709565b919050565b5f80fd5b611761816112c5565b811461176b575f80fd5b50565b5f8135905061177c81611758565b92915050565b5f60a08284031215611797576117966116d8565b5b6117a160a061173a565b90505f6117b08482850161150b565b5f8301525060206117c38482850161176e565b60208301525060406117d78482850161176e565b60408301525060606117eb8482850161176e565b60608301525060806117ff8482850161176e565b60808301525092915050565b5f60a082840312156118205761181f61120a565b5b5f61182d84828501611782565b91505092915050565b5f6060820190506118495f83018661134e565b61185660208301856112ce565b61186360408301846112ce565b949350505050565b5f80fd5b5f67ffffffffffffffff821115611889576118886116dc565b5b6118928261144a565b9050602081019050919050565b828183375f83830152505050565b5f6118bf6118ba8461186f565b61173a565b9050828152602081018484840111156118db576118da61186b565b5b6118e684828561189f565b509392505050565b5f82601f83011261190257611901611376565b5b81356119128482602086016118ad565b91505092915050565b5f604082840312156119305761192f6116d8565b5b61193a604061173a565b90505f6119498482850161150b565b5f83015250602082013567ffffffffffffffff81111561196c5761196b611754565b5b611978848285016118ee565b60208301525092915050565b5f602082840312156119995761199861120a565b5b5f82013567ffffffffffffffff8111156119b6576119b561120e565b5b6119c28482850161191b565b91505092915050565b5f815190506119d981611758565b92915050565b5f602082840312156119f4576119f361120a565b5b5f611a01848285016119cb565b91505092915050565b5f8160601b9050919050565b5f611a2082611a0a565b9050919050565b5f611a3182611a16565b9050919050565b611a49611a448261133d565b611a27565b82525050565b5f819050919050565b611a69611a64826112c5565b611a4f565b82525050565b5f611a7a8286611a38565b601482019150611a8a8285611a38565b601482019150611a9a8284611a58565b602082019150819050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b611ae1816112c5565b82525050565b602082015f820151611afb5f850182611ad8565b50505050565b5f602082019050611b145f830184611ae7565b92915050565b60038110611b2b57611b2a611aab565b5b50565b5f819050611b3b82611b1a565b919050565b5f611b4a82611b2e565b9050919050565b611b5a81611b40565b82525050565b611b698161133d565b82525050565b5f82825260208201905092915050565b5f611b8982611422565b611b938185611b6f565b9350611ba381856020860161143c565b611bac8161144a565b840191505092915050565b5f608083015f830151611bcc5f860182611b51565b506020830151611bdf6020860182611b60565b506040830151611bf26040860182611b60565b5060608301518482036060860152611c0a8282611b7f565b9150508091505092915050565b5f6020820190508181035f830152611c2f8184611bb7565b905092915050565b5f611c41826112c5565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611c7357611c726115a7565b5b60018201905091905056fea2646970667358221220f0478dd581ba0cfa3a9d6a7f556e0a4408663709607484acfcb56fa9be89d7cd64736f6c634300081a0033",s=class s extends i.DeployableTarget{constructor(){super(...arguments),this.abi=b.v}async owner(f){return b.Vy(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return b.By(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return b.Ly(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,a){return b.zy(this._config,{address:this.assertValidAddress(),args:[f],...a})}async asset(f){return b.Ey(this._config,{address:this.assertValidAddress(),...f})}async cgdaParams(f){const[a,d,e,t]=await b.Ry(this._config,{address:this.assertValidAddress(),...f});return{rewardDecay:a,rewardBoost:d,lastClaimTime:e,currentReward:t}}async totalBudget(f){return b.Dy(this._config,{address:this.assertValidAddress(),...f})}async claim(f,a){return this.awaitResult(this.claimRaw(f,a))}async claimRaw(f,a){const{request:d,result:e}=await b.Xy(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...a});return{hash:await b.Uy(this._config,d),result:e}}async clawback(f,a){return this.awaitResult(this.clawbackRaw(f,a))}async clawbackRaw(f,a){const{request:d,result:e}=await b.Yy(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...a});return{hash:await b.Gy(this._config,d),result:e}}async isClaimable(f,a){return b.Hy(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...a})}async currentReward(f){return b.xy(this._config,{address:this.assertValidAddress(),...f})}buildParameters(f,a){const[d,e]=this.validateDeploymentConfig(f,a);return{abi:b.v,bytecode:n,args:[c.prepareCGDAIncentivePayload(d)],...this.optionallyAttachAccount(e.account)}}};s.base="0x147c3aBFF7Ab7867B206A8c652Cd59D3BE41Dc3E",s.registryType=c.RegistryType.INCENTIVE;let r=s;exports.cgdaIncentiveAbi=b.v;exports.CGDAIncentive=r;
|
|
2
|
+
//# sourceMappingURL=CGDAIncentive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CGDAIncentive.cjs","sources":["../../src/Incentives/CGDAIncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type CGDAIncentivePayload,\n type CGDAParameters,\n type ClaimPayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareCGDAIncentivePayload,\n prepareClaimPayload,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\nexport type { CGDAIncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_CGDA_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(params?: ReadParams<typeof cgdaIncentiveAbi, 'owner'>) {\n return readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams<typeof cgdaIncentiveAbi, 'claims'>) {\n return readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams<typeof cgdaIncentiveAbi, 'reward'>) {\n return readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof cgdaIncentiveAbi, 'claimed'>,\n ) {\n return readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'asset'>} [params]\n * @returns {unknown}\n */\n public async asset(params?: ReadParams<typeof cgdaIncentiveAbi, 'asset'>) {\n return readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'cgdaParams'>} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'cgdaParams'>,\n ): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'totalBudget'>} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'totalBudget'>,\n ) {\n return readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'isClaimable'>} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof cgdaIncentiveAbi, 'isClaimable'>,\n ) {\n return readCgdaIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'currentReward'>,\n ) {\n return readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","readCgdaIncentiveCurrentReward","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","RegistryType","CGDAIncentive"],"mappings":"g7dA8DaA,EAAN,MAAMA,UAAsBC,EAAAA,gBAGjC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA2B/B,MAAa,MAAMC,EAAuD,CACjE,OAAAC,EAAA,GAAuB,KAAK,QAAS,CAC1C,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAwD,CACnE,OAAAE,EAAA,GAAwB,KAAK,QAAS,CAC3C,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,E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3D,CAWA,MAAa,YACXa,EACAb,EACA,CACA,KAAM,CAAE,QAAAc,EAAS,OAAAC,CAAO,EAAI,MAAMI,EAAA,GAChC,KAAK,QACL,CACE,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACF,sBAAoBJ,CAAO,CAAC,EACnC,GAAG,KAAK,wBAAwB,EAEhC,GAAIb,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMoB,EAA2B,GAAA,KAAK,QAASN,CAAO,EACpD,OAAAC,EACjB,CAWA,MAAa,YACXF,EACAb,EACA,CACO,OAAAqB,EAAA,GAA6B,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACJ,sBAAoBJ,CAAO,CAAC,EAEnC,GAAIb,CAAA,CACL,CACH,CAYA,MAAa,cACXA,EACA,CACO,OAAAsB,EAAA,GAA+B,KAAK,QAAS,CAClD,QAAS,KAAK,mBAAmB,EAEjC,GAAItB,CAAA,CACL,CACH,CAUgB,gBACduB,EACAC,EACyB,CACzB,KAAM,CAACX,EAASY,CAAO,EAAI,KAAK,yBAC9BF,EACAC,CAAA,EAEK,MAAA,CACL,IAAKzB,EAAA,EACL,SAAA2B,EACA,KAAM,CAACC,8BAA4Bd,CAAO,CAAC,EAC3C,GAAG,KAAK,wBAAwBY,EAAQ,OAAO,CAAA,CAEnD,CACF,EAjSyB5B,EAAA,KAAgB,6CASvCA,EAAuB,aAA6B+B,EAAa,aAAA,UArB5D,IAAMC,EAANhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CGDAIncentive.js","sources":["../../src/Incentives/CGDAIncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type CGDAIncentivePayload,\n type CGDAParameters,\n type ClaimPayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareCGDAIncentivePayload,\n prepareClaimPayload,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\nexport type { CGDAIncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_CGDA_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(params?: ReadParams<typeof cgdaIncentiveAbi, 'owner'>) {\n return readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams<typeof cgdaIncentiveAbi, 'claims'>) {\n return readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof allowListIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams<typeof cgdaIncentiveAbi, 'reward'>) {\n return readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof cgdaIncentiveAbi, 'claimed'>,\n ) {\n return readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'asset'>} [params]\n * @returns {unknown}\n */\n public async asset(params?: ReadParams<typeof cgdaIncentiveAbi, 'asset'>) {\n return readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'cgdaParams'>} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'cgdaParams'>,\n ): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'totalBudget'>} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'totalBudget'>,\n ) {\n return readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof cgdaIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof cgdaIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'isClaimable'>} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof cgdaIncentiveAbi, 'isClaimable'>,\n ) {\n return readCgdaIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams<typeof cgdaIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof cgdaIncentiveAbi, 'currentReward'>,\n ) {\n return readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","readCgdaIncentiveCurrentReward","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","RegistryType","CGDAIncentive"],"mappings":";;;kvdA8DaA,IAAN,MAAMA,UAAsBC,EAGjC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2B/B,MAAa,MAAMC,GAAuD;AACjE,WAAAC,EAAuB,KAAK,SAAS;AAAA,MAC1C,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAwD;AACnE,WAAAE,EAAwB,KAAK,SAAS;AAAA,MAC3C,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAwD;AACnE,WAAAG,EAAwB,KAAK,SAAS;AAAA,MAC3C,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIH;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,QACXI,GACAJ,GACA;AACO,WAAAK,EAAyB,KAAK,SAAS;AAAA,MAC5C,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACD,CAAO;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M,CAACX,GAASY,CAAO,IAAI,KAAK;AAAA,MAC9BF;AAAA,MACAC;AAAA,IAAA;AAEK,WAAA;AAAA,MACL,KAAKzB;AAAAA,MACL,UAAA2B;AAAA,MACA,MAAM,CAACC,EAA4Bd,CAAO,CAAC;AAAA,MAC3C,GAAG,KAAK,wBAAwBY,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AACF;AAjSyB5B,EAAA,OAAgB,8CASvCA,EAAuB,eAA6B+B,EAAa;AArB5D,IAAMC,IAANhC;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const b=require("../generated-Cd-Fe7W7.cjs"),i=require("../Deployable/DeployableTarget.cjs"),c=require("../utils.cjs"),n="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b612273806100bd5f395ff3fe60806040526004361061013f575f3560e01c8063715018a6116100b5578063c884ef831161006e578063c884ef83146103f1578063db09da121461042d578063dcc59b6f14610469578063f04e283e14610493578063f2fde38b146104af578063fee81cf4146104cb5761013f565b8063715018a6146102f15780638da5cb5b146102fb578063a4d66daf14610325578063a8c62e761461034f578063b30906d414610379578063bb1757cf146103b55761013f565b806328d6183b1161010757806328d6183b146101f357806338d52e0f1461021d578063439fab9114610247578063474f5a441461026f5780634e7165a2146102ab57806354d1f13d146102e75761013f565b806301ffc9a71461014357806307621eca1461017f5780632275aea9146101a9578063228cb733146101bf57806325692962146101e9575b5f80fd5b34801561014e575f80fd5b50610169600480360381019061016491906116eb565b610507565b6040516101769190611730565b60405180910390f35b34801561018a575f80fd5b50610193610580565b6040516101a09190611761565b60405180910390f35b3480156101b4575f80fd5b506101bd610589565b005b3480156101ca575f80fd5b506101d3610756565b6040516101e09190611761565b60405180910390f35b6101f161075c565b005b3480156101fe575f80fd5b506102076107ad565b6040516102149190611789565b60405180910390f35b348015610228575f80fd5b506102316107d4565b60405161023e91906117e1565b60405180910390f35b348015610252575f80fd5b5061026d6004803603810190610268919061185b565b6107f9565b005b34801561027a575f80fd5b506102956004803603810190610290919061185b565b610a2c565b6040516102a29190611730565b60405180910390f35b3480156102b6575f80fd5b506102d160048036038101906102cc919061185b565b610ca7565b6040516102de9190611916565b60405180910390f35b6102ef610dc5565b005b6102f9610dfe565b005b348015610306575f80fd5b5061030f610e11565b60405161031c91906117e1565b60405180910390f35b348015610330575f80fd5b50610339610e39565b6040516103469190611761565b60405180910390f35b34801561035a575f80fd5b50610363610e3f565b60405161037091906119a9565b60405180910390f35b348015610384575f80fd5b5061039f600480360381019061039a91906119ec565b610e52565b6040516103ac91906117e1565b60405180910390f35b3480156103c0575f80fd5b506103db60048036038101906103d69190611a41565b610e8d565b6040516103e89190611730565b60405180910390f35b3480156103fc575f80fd5b5061041760048036038101906104129190611a9e565b61117f565b6040516104249190611730565b60405180910390f35b348015610438575f80fd5b50610453600480360381019061044e9190611a41565b61119c565b6040516104609190611730565b60405180910390f35b348015610474575f80fd5b5061047d6111af565b60405161048a9190611761565b60405180910390f35b6104ad60048036038101906104a89190611a9e565b6111b4565b005b6104c960048036038101906104c49190611a9e565b6111f2565b005b3480156104d6575f80fd5b506104f160048036038101906104ec9190611a9e565b61121b565b6040516104fe9190611761565b60405180910390f35b5f7f8c901437000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610579575061057882611234565b5b9050919050565b5f600154905090565b6105916112ad565b6001808111156105a4576105a3611936565b5b600360149054906101000a900460ff1660018111156105c6576105c5611936565b5b146105fd576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f604051806020016040528042446106159190611af6565b81525090505f6005808054905061062b846112e4565b6106359190611b56565b8154811061064657610645611b86565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506106be8160015460035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f39092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168360015460405160200161072e93929190611c18565b60405160208183030381529060405260405161074a9190611916565b60405180910390a25050565b60015481565b5f61076561133c565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f8c90143700000000000000000000000000000000000000000000000000000000905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f610802611346565b905080546003825580156108345760018160011c14303b1061082b5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f83838101906108459190611d6c565b90505f8160400151148061085c57505f8160600151145b15610893576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6001808111156108a7576108a6611936565b5b826020015160018111156108be576108bd611936565b5b036108cd5781604001516108e2565b816060015182604001516108e19190611d97565b5b90505f61091130845f015173ffffffffffffffffffffffffffffffffffffffff1661136f90919063ffffffff16565b90508181101561095f57825f015181836040517f5c54305e00000000000000000000000000000000000000000000000000000000815260040161095693929190611dd8565b60405180910390fd5b825f015160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508260200151600360146101000a81548160ff021916908360018111156109cb576109ca611936565b5b0217905550826040015160018190555082606001516004819055506109ef336113a2565b5050508015610a27576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f610a356112ad565b5f8383810190610a459190611f26565b90505f8160200151806020019051810190610a609190611f81565b9050600180811115610a7557610a74611936565b5b600360149054906101000a900460ff166001811115610a9757610a96611936565b5b03610b1c5760015481141580610aad57505f8054115b15610b10573382604051602001610ac4919061203d565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610b0792919061205d565b60405180910390fd5b5f600481905550610bb4565b5f60015482610b2b9190611b56565b14610b8e573382604051602001610b42919061203d565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610b8592919061205d565b60405180910390fd5b60015481610b9c919061208b565b60045f828254610bac91906120bb565b925050819055505b610c03825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f39092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610c7793929190611c18565b604051602081830303815290604052604051610c939190611916565b60405180910390a260019250505092915050565b60605f8383810190610cb99190611d6c565b90505f600180811115610ccf57610cce611936565b5b82602001516001811115610ce657610ce5611936565b5b03610cf5578160400151610d0a565b81606001518260400151610d099190611d97565b5b9050604051806080016040528060016002811115610d2b57610d2a611936565b5b8152602001835f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610d8a9190612117565b604051602081830303815290604052815250604051602001610dac91906121d6565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610e066112ad565b610e0f5f611478565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b600360149054906101000a900460ff1681565b60058181548110610e61575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f610e966112ad565b610e9f8461153e565b610ed5576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6001811115610ee857610ee7611936565b5b600360149054906101000a900460ff166001811115610f0a57610f09611936565b5b03611065575f80815480929190610f20906121f6565b9190505550600160025f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550610fc88460015460035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166112f39092919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168660015460405160200161103893929190611c18565b6040516020818303038152906040526040516110549190611916565b60405180910390a260019050611178565b5f80815480929190611076906121f6565b9190505550600160025f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600584908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167ff0abe0f5c6f02112a9a4332e7b091bf49040ffddeedb73785a9b9a0a3ca7f15360405160405180910390a2600190505b9392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b5f6111a68461153e565b90509392505050565b5f5481565b6111bc6112ad565b63389a75e1600c52805f526020600c2080544211156111e257636f5e88185f526004601cfd5b5f8155506111ef81611478565b50565b6111fa6112ad565b8060601b61120f57637448fbae5f526004601cfd5b61121881611478565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806112a657506112a58261159f565b5b9050919050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275433146112e2576382b429005f526004601cfd5b565b5f602082209050808252919050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716611333576390b8ec185f526004601cfd5b5f603452505050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b6113aa611618565b15611422577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278054156113e457630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350611475565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b611480611618565b156114e5577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b821781555061153b565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f60025f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff1615801561159857506004545f54105b9050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061161157506116108261161c565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6116ca81611696565b81146116d4575f80fd5b50565b5f813590506116e5816116c1565b92915050565b5f60208284031215611700576116ff61168e565b5b5f61170d848285016116d7565b91505092915050565b5f8115159050919050565b61172a81611716565b82525050565b5f6020820190506117435f830184611721565b92915050565b5f819050919050565b61175b81611749565b82525050565b5f6020820190506117745f830184611752565b92915050565b61178381611696565b82525050565b5f60208201905061179c5f83018461177a565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6117cb826117a2565b9050919050565b6117db816117c1565b82525050565b5f6020820190506117f45f8301846117d2565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261181b5761181a6117fa565b5b8235905067ffffffffffffffff811115611838576118376117fe565b5b60208301915083600182028301111561185457611853611802565b5b9250929050565b5f80602083850312156118715761187061168e565b5b5f83013567ffffffffffffffff81111561188e5761188d611692565b5b61189a85828601611806565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f6118e8826118a6565b6118f281856118b0565b93506119028185602086016118c0565b61190b816118ce565b840191505092915050565b5f6020820190508181035f83015261192e81846118de565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6002811061197457611973611936565b5b50565b5f81905061198482611963565b919050565b5f61199382611977565b9050919050565b6119a381611989565b82525050565b5f6020820190506119bc5f83018461199a565b92915050565b6119cb81611749565b81146119d5575f80fd5b50565b5f813590506119e6816119c2565b92915050565b5f60208284031215611a0157611a0061168e565b5b5f611a0e848285016119d8565b91505092915050565b611a20816117c1565b8114611a2a575f80fd5b50565b5f81359050611a3b81611a17565b92915050565b5f805f60408486031215611a5857611a5761168e565b5b5f611a6586828701611a2d565b935050602084013567ffffffffffffffff811115611a8657611a85611692565b5b611a9286828701611806565b92509250509250925092565b5f60208284031215611ab357611ab261168e565b5b5f611ac084828501611a2d565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f611b0082611749565b9150611b0b83611749565b9250828201905080821115611b2357611b22611ac9565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611b6082611749565b9150611b6b83611749565b925082611b7b57611b7a611b29565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8160601b9050919050565b5f611bc982611bb3565b9050919050565b5f611bda82611bbf565b9050919050565b611bf2611bed826117c1565b611bd0565b82525050565b5f819050919050565b611c12611c0d82611749565b611bf8565b82525050565b5f611c238286611be1565b601482019150611c338285611be1565b601482019150611c438284611c01565b602082019150819050949350505050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b611c8e826118ce565b810181811067ffffffffffffffff82111715611cad57611cac611c58565b5b80604052505050565b5f611cbf611685565b9050611ccb8282611c85565b919050565b5f80fd5b60028110611ce0575f80fd5b50565b5f81359050611cf181611cd4565b92915050565b5f60808284031215611d0c57611d0b611c54565b5b611d166080611cb6565b90505f611d2584828501611a2d565b5f830152506020611d3884828501611ce3565b6020830152506040611d4c848285016119d8565b6040830152506060611d60848285016119d8565b60608301525092915050565b5f60808284031215611d8157611d8061168e565b5b5f611d8e84828501611cf7565b91505092915050565b5f611da182611749565b9150611dac83611749565b9250828202611dba81611749565b91508282048414831517611dd157611dd0611ac9565b5b5092915050565b5f606082019050611deb5f8301866117d2565b611df86020830185611752565b611e056040830184611752565b949350505050565b5f80fd5b5f67ffffffffffffffff821115611e2b57611e2a611c58565b5b611e34826118ce565b9050602081019050919050565b828183375f83830152505050565b5f611e61611e5c84611e11565b611cb6565b905082815260208101848484011115611e7d57611e7c611e0d565b5b611e88848285611e41565b509392505050565b5f82601f830112611ea457611ea36117fa565b5b8135611eb4848260208601611e4f565b91505092915050565b5f60408284031215611ed257611ed1611c54565b5b611edc6040611cb6565b90505f611eeb84828501611a2d565b5f83015250602082013567ffffffffffffffff811115611f0e57611f0d611cd0565b5b611f1a84828501611e90565b60208301525092915050565b5f60208284031215611f3b57611f3a61168e565b5b5f82013567ffffffffffffffff811115611f5857611f57611692565b5b611f6484828501611ebd565b91505092915050565b5f81519050611f7b816119c2565b92915050565b5f60208284031215611f9657611f9561168e565b5b5f611fa384828501611f6d565b91505092915050565b611fb5816117c1565b82525050565b5f82825260208201905092915050565b5f611fd5826118a6565b611fdf8185611fbb565b9350611fef8185602086016118c0565b611ff8816118ce565b840191505092915050565b5f604083015f8301516120185f860182611fac565b50602083015184820360208601526120308282611fcb565b9150508091505092915050565b5f6020820190508181035f8301526120558184612003565b905092915050565b5f6040820190506120705f8301856117d2565b818103602083015261208281846118de565b90509392505050565b5f61209582611749565b91506120a083611749565b9250826120b0576120af611b29565b5b828204905092915050565b5f6120c582611749565b91506120d083611749565b92508282039050818111156120e8576120e7611ac9565b5b92915050565b6120f781611749565b82525050565b602082015f8201516121115f8501826120ee565b50505050565b5f60208201905061212a5f8301846120fd565b92915050565b6003811061214157612140611936565b5b50565b5f81905061215182612130565b919050565b5f61216082612144565b9050919050565b61217081612156565b82525050565b5f608083015f83015161218b5f860182612167565b50602083015161219e6020860182611fac565b5060408301516121b16040860182611fac565b50606083015184820360608601526121c98282611fcb565b9150508091505092915050565b5f6020820190508181035f8301526121ee8184612176565b905092915050565b5f61220082611749565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361223257612231611ac9565b5b60018201905091905056fea264697066735822122035b61f4ea2c3b5fd5c3fe652b3fb2ea41d8542dbc6f57a84f75789864bfe9fc564736f6c634300081a0033",s=class s extends i.DeployableTarget{constructor(){super(...arguments),this.abi=b.f}async owner(f){return b.wm(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return b.cm(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return b.dm(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,a){return b.ym(this._config,{address:this.assertValidAddress(),args:[f],...a})}async asset(f){return b.lm(this._config,{address:this.assertValidAddress(),...f})}async strategy(f){return b.Nm(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return b.Am(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return b.vm(this._config,{address:this.assertValidAddress(),...f})}async entries(f,a){return b.mm(this._config,{address:this.assertValidAddress(),args:[f],...a})}async claim(f,a){return this.awaitResult(this.claimRaw(f,a))}async claimRaw(f,a){const{request:e,result:d}=await b._m(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...a});return{hash:await b.Om(this._config,e),result:d}}async clawback(f,a){return this.awaitResult(this.clawbackRaw(f,a))}async clawbackRaw(f,a){const{request:e,result:d}=await b.Fm(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...a});return{hash:await b.Cm(this._config,e),result:d}}async isClaimable(f,a){return b.fm(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...a})}async drawRaffle(f){return this.awaitResult(this.drawRaffleRaw(f))}async drawRaffleRaw(f){const{request:a,result:e}=await b.km(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...f});return{hash:await b.Rm(this._config,a),result:e}}buildParameters(f,a){const[e,d]=this.validateDeploymentConfig(f,a);return{abi:b.f,bytecode:n,args:[c.prepareERC20IncentivePayload(e)],...this.optionallyAttachAccount(d.account)}}};s.base="0xDCfbb7767B281Fd2d39fc7c39A9f89dC61E81f0d",s.registryType=c.RegistryType.INCENTIVE;let t=s;exports.erc20IncentiveAbi=b.f;exports.ERC20Incentive=t;
|
|
2
|
+
//# sourceMappingURL=ERC20Incentive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20Incentive.cjs","sources":["../../src/Incentives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n type ERC20IncentivePayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type StrategyType,\n type WriteParams,\n prepareClaimPayload,\n prepareERC20IncentivePayload,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\nexport type { ERC20IncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ERC20_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(params?: ReadParams<typeof erc20IncentiveAbi, 'owner'>) {\n return readErc20IncentiveOwner(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<typeof erc20IncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20IncentiveAbi, 'currentReward'>,\n ) {\n return readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams<typeof erc20IncentiveAbi, 'claims'>) {\n return readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20IncentiveAbi, 'claimed'>,\n ) {\n return readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'asset'>} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams<typeof erc20IncentiveAbi, 'asset'>) {\n return readErc20IncentiveAsset(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 strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'strategy'>} [params]\n * @returns {Promise<StrategyType>}\n */\n public async strategy(\n params?: ReadParams<typeof erc20IncentiveAbi, 'strategy'>,\n ): Promise<StrategyType> {\n return readErc20IncentiveStrategy(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 }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams<typeof erc20IncentiveAbi, 'reward'>) {\n return readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(params?: ReadParams<typeof erc20IncentiveAbi, 'limit'>) {\n return readErc20IncentiveLimit(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 set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'entries'>} [params]\n * @returns {Promise<Address>}\n */\n public async entries(\n i: bigint,\n params?: ReadParams<typeof erc20IncentiveAbi, 'entries'>,\n ) {\n return readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20IncentiveClaim(\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 writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20IncentiveClawback(\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 writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'isClaimable'>} [params]\n * @returns {unknown} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof erc20IncentiveAbi, 'isClaimable'>,\n ) {\n return readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(\n params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,\n ) {\n return this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffleRaw(\n params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,\n ) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\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 writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_payload","_options","options","bytecode","prepareERC20IncentivePayload","RegistryType","ERC20Incentive"],"mappings":"8yjBAgEaA,EAAN,MAAMA,UAA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,GAAG,KAAK,wBAAwB,EAEhC,GAAIrB,CACN,CAAA,EAGK,MAAA,CAAE,KADI,MAAMsB,EAA8B,GAAA,KAAK,QAAST,CAAO,EACvD,OAAAC,EACjB,CAUgB,gBACdS,EACAC,EACyB,CACzB,KAAM,CAACZ,EAASa,CAAO,EAAI,KAAK,yBAC9BF,EACAC,CAAA,EAEK,MAAA,CACL,IAAKzB,EAAA,EACL,SAAA2B,EACA,KAAM,CAACC,+BAA6Bf,CAAO,CAAC,EAC5C,GAAG,KAAK,wBAAwBa,EAAQ,OAAO,CAAA,CAEnD,CACF,EApVyB5B,EAAA,KAAgB,6CASvCA,EAAuB,aAA6B+B,EAAa,aAAA,UArB5D,IAAMC,EAANhC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ERC20Incentive.js","sources":["../../src/Incentives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n type ERC20IncentivePayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type StrategyType,\n type WriteParams,\n prepareClaimPayload,\n prepareERC20IncentivePayload,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\nexport type { ERC20IncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ERC20_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(params?: ReadParams<typeof erc20IncentiveAbi, 'owner'>) {\n return readErc20IncentiveOwner(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<typeof erc20IncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20IncentiveAbi, 'currentReward'>,\n ) {\n return readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams<typeof erc20IncentiveAbi, 'claims'>) {\n return readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20IncentiveAbi, 'claimed'>,\n ) {\n return readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'asset'>} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams<typeof erc20IncentiveAbi, 'asset'>) {\n return readErc20IncentiveAsset(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 strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'strategy'>} [params]\n * @returns {Promise<StrategyType>}\n */\n public async strategy(\n params?: ReadParams<typeof erc20IncentiveAbi, 'strategy'>,\n ): Promise<StrategyType> {\n return readErc20IncentiveStrategy(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 }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams<typeof erc20IncentiveAbi, 'reward'>) {\n return readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(params?: ReadParams<typeof erc20IncentiveAbi, 'limit'>) {\n return readErc20IncentiveLimit(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 set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'entries'>} [params]\n * @returns {Promise<Address>}\n */\n public async entries(\n i: bigint,\n params?: ReadParams<typeof erc20IncentiveAbi, 'entries'>,\n ) {\n return readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20IncentiveClaim(\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 writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20IncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20IncentiveClawback(\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 writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof erc20IncentiveAbi, 'isClaimable'>} [params]\n * @returns {unknown} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof erc20IncentiveAbi, 'isClaimable'>,\n ) {\n return readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(\n params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,\n ) {\n return this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffleRaw(\n params?: WriteParams<typeof erc20IncentiveAbi, 'drawRaffle'>,\n ) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\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 writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_payload","_options","options","bytecode","prepareERC20IncentivePayload","RegistryType","ERC20Incentive"],"mappings":";;;gnjBAgEaA,IAAN,MAAMA,UAAuBC,EAGlC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2B/B,MAAa,MAAMC,GAAwD;AAClE,WAAAC,EAAwB,KAAK,SAAS;AAAA,MAC3C,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,cACXA,GACA;AACO,WAAAE,EAAgC,KAAK,SAAS;AAAA,MACnD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CA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AAO,CAAC;AAAA,MAC5C,GAAG,KAAK,wBAAwBa,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AACF;AApVyB5B,EAAA,OAAgB,8CASvCA,EAAuB,eAA6B+B,EAAa;AArB5D,IAAMC,IAANhC;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-Cd-Fe7W7.cjs"),y=require("@wagmi/core"),g=require("../errors.cjs"),i=require("./AllowListIncentive.cjs"),o=require("./CGDAIncentive.cjs"),l=require("./ERC20Incentive.cjs"),A=require("../Deployable/DeployableTarget.cjs"),d=require("../utils.cjs"),h=require("./PointsIncentive.cjs"),w="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611c07806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063d54ad2a11161006e578063d54ad2a11461039b578063db09da12146103c5578063dcc59b6f14610401578063f04e283e1461042b578063f2fde38b14610447578063fee81cf41461046357610129565b8063715018a6146102c55780638da5cb5b146102cf578063a4d66daf146102f9578063bb1757cf14610323578063c884ef831461035f57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461027f57806354d1f13d146102bb57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190611115565b61049f565b604051610160919061115a565b60405180910390f35b348015610174575f80fd5b5061017d610518565b60405161018a919061118b565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b4919061118b565b60405180910390f35b6101c5610527565b005b3480156101d2575f80fd5b506101db610578565b6040516101e891906111b3565b60405180910390f35b3480156101fc575f80fd5b5061020561059f565b604051610212919061120b565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c9190611285565b6105c4565b005b34801561024e575f80fd5b5061026960048036038101906102649190611285565b610780565b604051610276919061115a565b60405180910390f35b34801561028a575f80fd5b506102a560048036038101906102a09190611285565b6108c1565b6040516102b29190611340565b60405180910390f35b6102c3610992565b005b6102cd6109cb565b005b3480156102da575f80fd5b506102e36109de565b6040516102f0919061120b565b60405180910390f35b348015610304575f80fd5b5061030d610a06565b60405161031a919061118b565b60405180910390f35b34801561032e575f80fd5b506103496004803603810190610344919061138a565b610a0c565b604051610356919061115a565b60405180910390f35b34801561036a575f80fd5b50610385600480360381019061038091906113e7565b610c04565b604051610392919061115a565b60405180910390f35b3480156103a6575f80fd5b506103af610c21565b6040516103bc919061118b565b60405180910390f35b3480156103d0575f80fd5b506103eb60048036038101906103e6919061138a565b610c27565b6040516103f8919061115a565b60405180910390f35b34801561040c575f80fd5b50610415610c3a565b604051610422919061118b565b60405180910390f35b610445600480360381019061044091906113e7565b610c3f565b005b610461600480360381019061045c91906113e7565b610c7d565b005b34801561046e575f80fd5b50610489600480360381019061048491906113e7565b610ca6565b604051610496919061118b565b60405180910390f35b5f7f6060409d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610511575061051082610cbf565b5b9050919050565b5f600154905090565b60015481565b5f610530610d38565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f6060409d00000000000000000000000000000000000000000000000000000000905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f6105cd610d42565b905080546003825580156105ff5760018160011c14303b106105f65763f92ee8a95f526004601cfd5b818160ff1b1b91505b5061060933610d6b565b5f8383810190610619919061151d565b90505f815f015190505f826020015190505f836040015190505f810361066b576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610695308573ffffffffffffffffffffffffffffffffffffffff16610e4190919063ffffffff16565b9050818110156106e357845f015181836040517f5c54305e0000000000000000000000000000000000000000000000000000000081526004016106da93929190611548565b60405180910390fd5b8360035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600181905550816004819055505f60058190555061074133610d6b565b5050505050801561077b576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f610789610e74565b5f83838101906107999190611696565b90505f81602001518060200190518101906107b491906116f1565b90508060045f8282546107c79190611749565b9250508190555061081d825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610891939291906117e1565b6040516020818303038152906040526040516108ad9190611340565b60405180910390a260019250505092915050565b60605f805f85858101906108d59190611858565b9250925092506040518060800160405280600160028111156108fa576108f96118a8565b5b81526020018473ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808481525060405160200161095691906118fe565b6040516020818303038152906040528152506040516020016109789190611a14565b604051602081830303815290604052935050505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6109d3610e74565b6109dc5f610ef4565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b5f610a15610e74565b5f8383810190610a259190611ab9565b90505f8160200151806020019051810190610a4091906116f1565b90505f610a4c87610fba565b610a82576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60015403610a9357819050610ab7565b670de0b6b3a764000082600154610aaa9190611b00565b610ab49190611b6e565b90505b60045481600554610ac89190611b9e565b1115610b00576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f828254610b119190611b9e565b92505081905550610b64878260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b8673ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168984604051602001610bd2939291906117e1565b604051602081830303815290604052604051610bee9190611340565b60405180910390a2600193505050509392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b60055481565b5f610c3184610fba565b90509392505050565b5f5481565b610c47610e74565b63389a75e1600c52805f526020600c208054421115610c6d57636f5e88185f526004601cfd5b5f815550610c7a81610ef4565b50565b610c85610e74565b8060601b610c9a57637448fbae5f526004601cfd5b610ca381610ef4565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d315750610d3082610fc9565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610d73611042565b15610deb577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610dad57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610e3e565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610ea9576382b429005f526004601cfd5b565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716610eeb576390b8ec185f526004601cfd5b5f603452505050565b610efc611042565b15610f61577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610fb7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f600454600554109050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061103b575061103a82611046565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6110f4816110c0565b81146110fe575f80fd5b50565b5f8135905061110f816110eb565b92915050565b5f6020828403121561112a576111296110b8565b5b5f61113784828501611101565b91505092915050565b5f8115159050919050565b61115481611140565b82525050565b5f60208201905061116d5f83018461114b565b92915050565b5f819050919050565b61118581611173565b82525050565b5f60208201905061119e5f83018461117c565b92915050565b6111ad816110c0565b82525050565b5f6020820190506111c65f8301846111a4565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6111f5826111cc565b9050919050565b611205816111eb565b82525050565b5f60208201905061121e5f8301846111fc565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261124557611244611224565b5b8235905067ffffffffffffffff81111561126257611261611228565b5b60208301915083600182028301111561127e5761127d61122c565b5b9250929050565b5f806020838503121561129b5761129a6110b8565b5b5f83013567ffffffffffffffff8111156112b8576112b76110bc565b5b6112c485828601611230565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611312826112d0565b61131c81856112da565b935061132c8185602086016112ea565b611335816112f8565b840191505092915050565b5f6020820190508181035f8301526113588184611308565b905092915050565b611369816111eb565b8114611373575f80fd5b50565b5f8135905061138481611360565b92915050565b5f805f604084860312156113a1576113a06110b8565b5b5f6113ae86828701611376565b935050602084013567ffffffffffffffff8111156113cf576113ce6110bc565b5b6113db86828701611230565b92509250509250925092565b5f602082840312156113fc576113fb6110b8565b5b5f61140984828501611376565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61144c826112f8565b810181811067ffffffffffffffff8211171561146b5761146a611416565b5b80604052505050565b5f61147d6110af565b90506114898282611443565b919050565b5f80fd5b61149b81611173565b81146114a5575f80fd5b50565b5f813590506114b681611492565b92915050565b5f606082840312156114d1576114d0611412565b5b6114db6060611474565b90505f6114ea84828501611376565b5f8301525060206114fd848285016114a8565b6020830152506040611511848285016114a8565b60408301525092915050565b5f60608284031215611532576115316110b8565b5b5f61153f848285016114bc565b91505092915050565b5f60608201905061155b5f8301866111fc565b611568602083018561117c565b611575604083018461117c565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561159b5761159a611416565b5b6115a4826112f8565b9050602081019050919050565b828183375f83830152505050565b5f6115d16115cc84611581565b611474565b9050828152602081018484840111156115ed576115ec61157d565b5b6115f88482856115b1565b509392505050565b5f82601f83011261161457611613611224565b5b81356116248482602086016115bf565b91505092915050565b5f6040828403121561164257611641611412565b5b61164c6040611474565b90505f61165b84828501611376565b5f83015250602082013567ffffffffffffffff81111561167e5761167d61148e565b5b61168a84828501611600565b60208301525092915050565b5f602082840312156116ab576116aa6110b8565b5b5f82013567ffffffffffffffff8111156116c8576116c76110bc565b5b6116d48482850161162d565b91505092915050565b5f815190506116eb81611492565b92915050565b5f60208284031215611706576117056110b8565b5b5f611713848285016116dd565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61175382611173565b915061175e83611173565b92508282039050818111156117765761177561171c565b5b92915050565b5f8160601b9050919050565b5f6117928261177c565b9050919050565b5f6117a382611788565b9050919050565b6117bb6117b6826111eb565b611799565b82525050565b5f819050919050565b6117db6117d682611173565b6117c1565b82525050565b5f6117ec82866117aa565b6014820191506117fc82856117aa565b60148201915061180c82846117ca565b602082019150819050949350505050565b5f611827826111cc565b9050919050565b6118378161181d565b8114611841575f80fd5b50565b5f813590506118528161182e565b92915050565b5f805f6060848603121561186f5761186e6110b8565b5b5f61187c86828701611844565b935050602061188d868287016114a8565b925050604061189e868287016114a8565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6118de81611173565b82525050565b602082015f8201516118f85f8501826118d5565b50505050565b5f6020820190506119115f8301846118e4565b92915050565b60038110611928576119276118a8565b5b50565b5f81905061193882611917565b919050565b5f6119478261192b565b9050919050565b6119578161193d565b82525050565b611966816111eb565b82525050565b5f82825260208201905092915050565b5f611986826112d0565b611990818561196c565b93506119a08185602086016112ea565b6119a9816112f8565b840191505092915050565b5f608083015f8301516119c95f86018261194e565b5060208301516119dc602086018261195d565b5060408301516119ef604086018261195d565b5060608301518482036060860152611a07828261197c565b9150508091505092915050565b5f6020820190508181035f830152611a2c81846119b4565b905092915050565b5f60408284031215611a4957611a48611412565b5b611a536040611474565b90505f82013567ffffffffffffffff811115611a7257611a7161148e565b5b611a7e84828501611600565b5f83015250602082013567ffffffffffffffff811115611aa157611aa061148e565b5b611aad84828501611600565b60208301525092915050565b5f60208284031215611ace57611acd6110b8565b5b5f82013567ffffffffffffffff811115611aeb57611aea6110bc565b5b611af784828501611a34565b91505092915050565b5f611b0a82611173565b9150611b1583611173565b9250828202611b2381611173565b91508282048414831517611b3a57611b3961171c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611b7882611173565b9150611b8383611173565b925082611b9357611b92611b41565b5b828204905092915050565b5f611ba882611173565b9150611bb383611173565b9250828201905080821115611bcb57611bca61171c565b5b9291505056fea2646970667358221220a9439a260a68f54e27503ba4a35d38eead0eee9484d16611fb206387bc2ede8564736f6c634300081a0033",t=class t extends A.DeployableTarget{constructor(){super(...arguments),this.abi=e.w}async owner(f){return e.sb(this._config,{address:this.assertValidAddress(),args:[],...f})}async totalClaimed(f){return e.lb(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return e.tb(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return e.eb(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return e.Ym(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return e.Xm(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return e.pb(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return e.ib(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:a,result:c}=await e.Nb(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.cb(this._config,a),result:c}}async clawback(f,b){return this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:a,result:c}=await e.hb(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.mb(this._config,a),result:c}}async isClaimable(f,b){return e.ab(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...b})}buildParameters(f,b){const[a,c]=this.validateDeploymentConfig(f,b);return{abi:e.w,bytecode:w,args:[d.prepareERC20VariableIncentivePayload(a)],...this.optionallyAttachAccount(c.account)}}};t.base="0xA7b6c33828693d431C64e59A27d985c4DfB19B95",t.registryType=d.RegistryType.INCENTIVE;let s=t;const r={"0xc5b24b8e":h.PointsIncentive,"0x8c901437":l.ERC20Incentive,"0x0a466e6f":i.AllowListIncentive,"0xa39e44d9":o.CGDAIncentive,"0x6060409d":s};async function m(n,f){const b=await y.readContract(n.config,{abi:e.G,functionName:"getComponentInterface",address:f}),a=r[b];if(!a)throw new g.InvalidComponentInterfaceError(Object.keys(r),b);return new a(n,f)}exports.AllowListIncentive=i.AllowListIncentive;exports.CGDAIncentive=o.CGDAIncentive;exports.ERC20Incentive=l.ERC20Incentive;exports.PointsIncentive=h.PointsIncentive;exports.ERC20VariableIncentive=s;exports.IncentiveByComponentInterface=r;exports.incentiveFromAddress=m;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-Cd-Fe7W7.cjs"),s=require("../componentInterfaces-CKCBwG16.cjs"),A=require("@wagmi/core"),g=require("../errors.cjs"),o=require("./AllowListIncentive.cjs"),l=require("./CGDAIncentive.cjs"),h=require("./ERC20Incentive.cjs"),I=require("../Deployable/DeployableTarget.cjs"),d=require("../utils.cjs"),u=require("./PointsIncentive.cjs"),m="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b611c07806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063d54ad2a11161006e578063d54ad2a11461039b578063db09da12146103c5578063dcc59b6f14610401578063f04e283e1461042b578063f2fde38b14610447578063fee81cf41461046357610129565b8063715018a6146102c55780638da5cb5b146102cf578063a4d66daf146102f9578063bb1757cf14610323578063c884ef831461035f57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461027f57806354d1f13d146102bb57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190611115565b61049f565b604051610160919061115a565b60405180910390f35b348015610174575f80fd5b5061017d610518565b60405161018a919061118b565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b4919061118b565b60405180910390f35b6101c5610527565b005b3480156101d2575f80fd5b506101db610578565b6040516101e891906111b3565b60405180910390f35b3480156101fc575f80fd5b5061020561059f565b604051610212919061120b565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c9190611285565b6105c4565b005b34801561024e575f80fd5b5061026960048036038101906102649190611285565b610780565b604051610276919061115a565b60405180910390f35b34801561028a575f80fd5b506102a560048036038101906102a09190611285565b6108c1565b6040516102b29190611340565b60405180910390f35b6102c3610992565b005b6102cd6109cb565b005b3480156102da575f80fd5b506102e36109de565b6040516102f0919061120b565b60405180910390f35b348015610304575f80fd5b5061030d610a06565b60405161031a919061118b565b60405180910390f35b34801561032e575f80fd5b506103496004803603810190610344919061138a565b610a0c565b604051610356919061115a565b60405180910390f35b34801561036a575f80fd5b50610385600480360381019061038091906113e7565b610c04565b604051610392919061115a565b60405180910390f35b3480156103a6575f80fd5b506103af610c21565b6040516103bc919061118b565b60405180910390f35b3480156103d0575f80fd5b506103eb60048036038101906103e6919061138a565b610c27565b6040516103f8919061115a565b60405180910390f35b34801561040c575f80fd5b50610415610c3a565b604051610422919061118b565b60405180910390f35b610445600480360381019061044091906113e7565b610c3f565b005b610461600480360381019061045c91906113e7565b610c7d565b005b34801561046e575f80fd5b50610489600480360381019061048491906113e7565b610ca6565b604051610496919061118b565b60405180910390f35b5f7f6060409d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610511575061051082610cbf565b5b9050919050565b5f600154905090565b60015481565b5f610530610d38565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f6060409d00000000000000000000000000000000000000000000000000000000905090565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f6105cd610d42565b905080546003825580156105ff5760018160011c14303b106105f65763f92ee8a95f526004601cfd5b818160ff1b1b91505b5061060933610d6b565b5f8383810190610619919061151d565b90505f815f015190505f826020015190505f836040015190505f810361066b576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610695308573ffffffffffffffffffffffffffffffffffffffff16610e4190919063ffffffff16565b9050818110156106e357845f015181836040517f5c54305e0000000000000000000000000000000000000000000000000000000081526004016106da93929190611548565b60405180910390fd5b8360035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600181905550816004819055505f60058190555061074133610d6b565b5050505050801561077b576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f610789610e74565b5f83838101906107999190611696565b90505f81602001518060200190518101906107b491906116f1565b90508060045f8282546107c79190611749565b9250508190555061081d825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610891939291906117e1565b6040516020818303038152906040526040516108ad9190611340565b60405180910390a260019250505092915050565b60605f805f85858101906108d59190611858565b9250925092506040518060800160405280600160028111156108fa576108f96118a8565b5b81526020018473ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808481525060405160200161095691906118fe565b6040516020818303038152906040528152506040516020016109789190611a14565b604051602081830303815290604052935050505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6109d3610e74565b6109dc5f610ef4565b565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b5f610a15610e74565b5f8383810190610a259190611ab9565b90505f8160200151806020019051810190610a4091906116f1565b90505f610a4c87610fba565b610a82576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60015403610a9357819050610ab7565b670de0b6b3a764000082600154610aaa9190611b00565b610ab49190611b6e565b90505b60045481600554610ac89190611b9e565b1115610b00576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f828254610b119190611b9e565b92505081905550610b64878260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16610eab9092919063ffffffff16565b8673ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168984604051602001610bd2939291906117e1565b604051602081830303815290604052604051610bee9190611340565b60405180910390a2600193505050509392505050565b6002602052805f5260405f205f915054906101000a900460ff1681565b60055481565b5f610c3184610fba565b90509392505050565b5f5481565b610c47610e74565b63389a75e1600c52805f526020600c208054421115610c6d57636f5e88185f526004601cfd5b5f815550610c7a81610ef4565b50565b610c85610e74565b8060601b610c9a57637448fbae5f526004601cfd5b610ca381610ef4565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7f5970a689000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610d315750610d3082610fc9565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610d73611042565b15610deb577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610dad57630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610e3e565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610ea9576382b429005f526004601cfd5b565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716610eeb576390b8ec185f526004601cfd5b5f603452505050565b610efc611042565b15610f61577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610fb7565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f600454600554109050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061103b575061103a82611046565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b6110f4816110c0565b81146110fe575f80fd5b50565b5f8135905061110f816110eb565b92915050565b5f6020828403121561112a576111296110b8565b5b5f61113784828501611101565b91505092915050565b5f8115159050919050565b61115481611140565b82525050565b5f60208201905061116d5f83018461114b565b92915050565b5f819050919050565b61118581611173565b82525050565b5f60208201905061119e5f83018461117c565b92915050565b6111ad816110c0565b82525050565b5f6020820190506111c65f8301846111a4565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6111f5826111cc565b9050919050565b611205816111eb565b82525050565b5f60208201905061121e5f8301846111fc565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261124557611244611224565b5b8235905067ffffffffffffffff81111561126257611261611228565b5b60208301915083600182028301111561127e5761127d61122c565b5b9250929050565b5f806020838503121561129b5761129a6110b8565b5b5f83013567ffffffffffffffff8111156112b8576112b76110bc565b5b6112c485828601611230565b92509250509250929050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611312826112d0565b61131c81856112da565b935061132c8185602086016112ea565b611335816112f8565b840191505092915050565b5f6020820190508181035f8301526113588184611308565b905092915050565b611369816111eb565b8114611373575f80fd5b50565b5f8135905061138481611360565b92915050565b5f805f604084860312156113a1576113a06110b8565b5b5f6113ae86828701611376565b935050602084013567ffffffffffffffff8111156113cf576113ce6110bc565b5b6113db86828701611230565b92509250509250925092565b5f602082840312156113fc576113fb6110b8565b5b5f61140984828501611376565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61144c826112f8565b810181811067ffffffffffffffff8211171561146b5761146a611416565b5b80604052505050565b5f61147d6110af565b90506114898282611443565b919050565b5f80fd5b61149b81611173565b81146114a5575f80fd5b50565b5f813590506114b681611492565b92915050565b5f606082840312156114d1576114d0611412565b5b6114db6060611474565b90505f6114ea84828501611376565b5f8301525060206114fd848285016114a8565b6020830152506040611511848285016114a8565b60408301525092915050565b5f60608284031215611532576115316110b8565b5b5f61153f848285016114bc565b91505092915050565b5f60608201905061155b5f8301866111fc565b611568602083018561117c565b611575604083018461117c565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561159b5761159a611416565b5b6115a4826112f8565b9050602081019050919050565b828183375f83830152505050565b5f6115d16115cc84611581565b611474565b9050828152602081018484840111156115ed576115ec61157d565b5b6115f88482856115b1565b509392505050565b5f82601f83011261161457611613611224565b5b81356116248482602086016115bf565b91505092915050565b5f6040828403121561164257611641611412565b5b61164c6040611474565b90505f61165b84828501611376565b5f83015250602082013567ffffffffffffffff81111561167e5761167d61148e565b5b61168a84828501611600565b60208301525092915050565b5f602082840312156116ab576116aa6110b8565b5b5f82013567ffffffffffffffff8111156116c8576116c76110bc565b5b6116d48482850161162d565b91505092915050565b5f815190506116eb81611492565b92915050565b5f60208284031215611706576117056110b8565b5b5f611713848285016116dd565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61175382611173565b915061175e83611173565b92508282039050818111156117765761177561171c565b5b92915050565b5f8160601b9050919050565b5f6117928261177c565b9050919050565b5f6117a382611788565b9050919050565b6117bb6117b6826111eb565b611799565b82525050565b5f819050919050565b6117db6117d682611173565b6117c1565b82525050565b5f6117ec82866117aa565b6014820191506117fc82856117aa565b60148201915061180c82846117ca565b602082019150819050949350505050565b5f611827826111cc565b9050919050565b6118378161181d565b8114611841575f80fd5b50565b5f813590506118528161182e565b92915050565b5f805f6060848603121561186f5761186e6110b8565b5b5f61187c86828701611844565b935050602061188d868287016114a8565b925050604061189e868287016114a8565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b6118de81611173565b82525050565b602082015f8201516118f85f8501826118d5565b50505050565b5f6020820190506119115f8301846118e4565b92915050565b60038110611928576119276118a8565b5b50565b5f81905061193882611917565b919050565b5f6119478261192b565b9050919050565b6119578161193d565b82525050565b611966816111eb565b82525050565b5f82825260208201905092915050565b5f611986826112d0565b611990818561196c565b93506119a08185602086016112ea565b6119a9816112f8565b840191505092915050565b5f608083015f8301516119c95f86018261194e565b5060208301516119dc602086018261195d565b5060408301516119ef604086018261195d565b5060608301518482036060860152611a07828261197c565b9150508091505092915050565b5f6020820190508181035f830152611a2c81846119b4565b905092915050565b5f60408284031215611a4957611a48611412565b5b611a536040611474565b90505f82013567ffffffffffffffff811115611a7257611a7161148e565b5b611a7e84828501611600565b5f83015250602082013567ffffffffffffffff811115611aa157611aa061148e565b5b611aad84828501611600565b60208301525092915050565b5f60208284031215611ace57611acd6110b8565b5b5f82013567ffffffffffffffff811115611aeb57611aea6110bc565b5b611af784828501611a34565b91505092915050565b5f611b0a82611173565b9150611b1583611173565b9250828202611b2381611173565b91508282048414831517611b3a57611b3961171c565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f611b7882611173565b9150611b8383611173565b925082611b9357611b92611b41565b5b828204905092915050565b5f611ba882611173565b9150611bb383611173565b9250828201905080821115611bcb57611bca61171c565b5b9291505056fea2646970667358221220a9439a260a68f54e27503ba4a35d38eead0eee9484d16611fb206387bc2ede8564736f6c634300081a0033",n=class n extends I.DeployableTarget{constructor(){super(...arguments),this.abi=e.w}async owner(f){return e.sb(this._config,{address:this.assertValidAddress(),args:[],...f})}async totalClaimed(f){return e.lb(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return e.tb(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return e.eb(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return e.Ym(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return e.Xm(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return e.pb(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return e.ib(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:a,result:c}=await e.Nb(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.cb(this._config,a),result:c}}async clawback(f,b){return this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:a,result:c}=await e.hb(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.mb(this._config,a),result:c}}async isClaimable(f,b){return e.ab(this._config,{address:this.assertValidAddress(),args:[d.prepareClaimPayload(f)],...b})}buildParameters(f,b){const[a,c]=this.validateDeploymentConfig(f,b);return{abi:e.w,bytecode:m,args:[d.prepareERC20VariableIncentivePayload(a)],...this.optionallyAttachAccount(c.account)}}};n.base="0xA7b6c33828693d431C64e59A27d985c4DfB19B95",n.registryType=d.RegistryType.INCENTIVE;let t=n;const i={[s.APointsIncentive]:u.PointsIncentive,[s.AERC20Incentive]:h.ERC20Incentive,"0x0a466e6f":o.AllowListIncentive,[s.ACGDAIncentive]:l.CGDAIncentive,[s.AERC20VariableIncentive]:t};async function v(r,f){const b=await A.readContract(r.config,{abi:e.G,functionName:"getComponentInterface",address:f}),a=i[b];if(!a)throw new g.InvalidComponentInterfaceError(Object.keys(i),b);return new a(r,f)}exports.AllowListIncentive=o.AllowListIncentive;exports.CGDAIncentive=l.CGDAIncentive;exports.ERC20Incentive=h.ERC20Incentive;exports.PointsIncentive=u.PointsIncentive;exports.ERC20VariableIncentive=t;exports.IncentiveByComponentInterface=i;exports.incentiveFromAddress=v;
|
|
2
|
+
//# sourceMappingURL=Incentive.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive.cjs","sources":["../../src/Incentives/ERC20VariableIncentive.ts","../../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20VariableIncentiveAbi,\n readErc20VariableIncentiveAsset,\n readErc20VariableIncentiveClaimed,\n readErc20VariableIncentiveClaims,\n readErc20VariableIncentiveCurrentReward,\n readErc20VariableIncentiveIsClaimable,\n readErc20VariableIncentiveLimit,\n readErc20VariableIncentiveOwner,\n readErc20VariableIncentiveReward,\n readErc20VariableIncentiveTotalClaimed,\n simulateErc20VariableIncentiveClaim,\n simulateErc20VariableIncentiveClawback,\n writeErc20VariableIncentiveClaim,\n writeErc20VariableIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableIncentive.sol/ERC20VariableIncentive.json';\nimport type { Address, ContractEventName, Hex } from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n type ERC20VariableIncentivePayload,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareClaimPayload,\n prepareERC20VariableIncentivePayload,\n} from '../utils';\n\nexport { erc20VariableIncentiveAbi };\nexport type { ERC20VariableIncentivePayload };\n\n/**\n * A generic `viem.Log` event with support for `ERC20VariableIncentive` event types.\n *\n * @export\n * @typedef {ERC20VariableIncentiveLog}\n * @template {ContractEventName<typeof erc20VariableIncentiveAbi>} [event=ContractEventName<\n * typeof erc20VariableIncentiveAbi\n * >]\n */\nexport type ERC20VariableIncentiveLog<\n event extends ContractEventName<\n typeof erc20VariableIncentiveAbi\n > = ContractEventName<typeof erc20VariableIncentiveAbi>,\n> = GenericLog<typeof erc20VariableIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20VariableIncentive\n * @typedef {ERC20VariableIncentive}\n * @extends {DeployableTarget<ERC20VariableIncentivePayload>}\n */\nexport class ERC20VariableIncentive extends DeployableTarget<\n ERC20VariableIncentivePayload,\n typeof erc20VariableIncentiveAbi\n> {\n public override readonly abi = erc20VariableIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_ERC20_VARIABLE_INCENTIVE_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>} [params]\n * @returns {unknown}\n */\n public async owner(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,\n ) {\n return readErc20VariableIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async totalClaimed(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>,\n ) {\n return readErc20VariableIncentiveTotalClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The current reward\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>,\n ) {\n return readErc20VariableIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>,\n ) {\n return readErc20VariableIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>,\n ) {\n return readErc20VariableIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>} [params]\n * @returns {Promise<Address>}\n */\n public async asset(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>,\n ) {\n return readErc20VariableIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>,\n ) {\n return readErc20VariableIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>} [params]\n * @returns {unknown}\n */\n public async limit(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,\n ) {\n return readErc20VariableIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n return this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n public async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20VariableIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20VariableIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>} [params]\n * @returns {unknown} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: ClaimPayload,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'isClaimable'>,\n ) {\n return readErc20VariableIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20VariableIncentive,\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n PointsIncentive,\n ERC20VariableIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | PointsIncentive\n | ERC20VariableIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x0a466e6f\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0x6060409d\": typeof ERC20VariableIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n // TODO: figure out why evm generates bad bytes4 here\n ['0x0a466e6f']: AllowListIncentive,\n // [APointsIncentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {unknown}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20VariableIncentive","DeployableTarget","erc20VariableIncentiveAbi","params","readErc20VariableIncentiveOwner","readErc20VariableIncentiveTotalClaimed","readErc20VariableIncentiveCurrentReward","readErc20VariableIncentiveClaims","address","readErc20VariableIncentiveClaimed","readErc20VariableIncentiveAsset","readErc20VariableIncentiveReward","readErc20VariableIncentiveLimit","payload","request","result","simulateErc20VariableIncentiveClaim","prepareClaimPayload","writeErc20VariableIncentiveClaim","simulateErc20VariableIncentiveClawback","writeErc20VariableIncentiveClawback","readErc20VariableIncentiveIsClaimable","_payload","_options","options","bytecode","prepareERC20VariableIncentivePayload","RegistryType","ERC20VariableIncentive","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":"u0dA4DaA,EAAN,MAAMA,UAA+BC,EAAAA,gBAG1C,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA2B/B,MAAa,MACXC,EACA,CACO,OAAAC,EAAA,GAAgC,KAAK,QAAS,CACnD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,aACXA,EACA,CACO,OAAAE,EAAA,GAAuC,KAAK,QAAS,CAC1D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,cACXA,EACA,CACO,OAAAG,EAAA,GAAwC,KAAK,QAAS,CAC3D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAUA,MAAa,OACXA,EACA,CACO,OAAAI,EAAA,GAAiC,KAAK,QAAS,CACpD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIJ,CAAA,CACL,CACH,CAWA,MAAa,QACXK,EACAL,EACA,CACO,OAAAM,EAAA,GAAkC,KAAK,QAAS,CACrD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EAEd,GAAIL,CAAA,CACL,CACH,CAUA,MAAa,MACXA,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