@boostxyz/sdk 2.1.2 → 2.2.1
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 +1 -1
- package/dist/Actions/Action.cjs.map +1 -1
- package/dist/Actions/Action.d.ts +2 -1
- package/dist/Actions/Action.d.ts.map +1 -1
- package/dist/Actions/Action.js +14 -13
- package/dist/Actions/Action.js.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +219 -0
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +39 -39
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -1
- package/dist/AllowLists/AllowList.d.ts +2 -1
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +18 -17
- package/dist/AllowLists/AllowList.js.map +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.js +9 -9
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +2 -2
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +33 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +98 -81
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +12 -12
- package/dist/{Budget-CUIFf1Br.js → Budget-2Zb3Mb-8.js} +40 -39
- package/dist/{Budget-CUIFf1Br.js.map → Budget-2Zb3Mb-8.js.map} +1 -1
- package/dist/{Budget-cI30CIMN.cjs → Budget-2xKEvkbL.cjs} +2 -2
- package/dist/{Budget-cI30CIMN.cjs.map → Budget-2xKEvkbL.cjs.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.d.ts +2 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +3 -3
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +33 -33
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +158 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +268 -31
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -1
- package/dist/Incentive-CfIjdL4T.cjs +2 -0
- package/dist/Incentive-CfIjdL4T.cjs.map +1 -0
- package/dist/Incentive-DNwTyG5Z.js +393 -0
- package/dist/Incentive-DNwTyG5Z.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +28 -28
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +30 -0
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +25 -25
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +25 -0
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +30 -0
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +42 -42
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts +905 -0
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +67 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +31 -31
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +20 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +18 -18
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.d.ts +26 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +20 -40
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +25 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +29 -29
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-Ds0CQ4uR.cjs → SimpleDenyList-BQ0GqQfC.cjs} +2 -2
- package/dist/{SimpleDenyList-Ds0CQ4uR.cjs.map → SimpleDenyList-BQ0GqQfC.cjs.map} +1 -1
- package/dist/{SimpleDenyList-CXruWOyu.js → SimpleDenyList-D49GF3NX.js} +11 -11
- package/dist/{SimpleDenyList-CXruWOyu.js.map → SimpleDenyList-D49GF3NX.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts +10 -0
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +15 -15
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +10 -0
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +8 -8
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +2 -1
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +20 -19
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/{componentInterfaces-dakxtQHf.js → componentInterfaces-C4uAYjSo.js} +12 -12
- package/dist/componentInterfaces-C4uAYjSo.js.map +1 -0
- package/dist/deployments.json +3 -0
- package/dist/{generated-BTslM7bf.js → generated-B5pVBNb-.js} +1835 -730
- package/dist/generated-B5pVBNb-.js.map +1 -0
- package/dist/generated-D50hBWtr.cjs +3 -0
- package/dist/generated-D50hBWtr.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +113 -110
- package/package.json +2 -2
- package/src/Actions/Action.ts +3 -0
- package/src/Actions/EventAction.test.ts +49 -2
- package/src/Actions/EventAction.ts +12 -4
- package/src/AllowLists/AllowList.ts +3 -0
- package/src/BoostCore.ts +27 -5
- package/src/Budgets/Budget.ts +3 -0
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +175 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +281 -0
- package/src/Incentives/AllowListIncentive.test.ts +48 -0
- package/src/Incentives/AllowListIncentive.ts +1 -1
- package/src/Incentives/CGDAIncentive.test.ts +50 -0
- package/src/Incentives/CGDAIncentive.ts +1 -1
- package/src/Incentives/ERC1155Incentive.ts +1 -1
- package/src/Incentives/ERC20Incentive.test.ts +49 -0
- package/src/Incentives/ERC20Incentive.ts +1 -1
- package/src/Incentives/ERC20PeggedIncentive.ts +507 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +48 -0
- package/src/Incentives/ERC20VariableIncentive.ts +1 -1
- package/src/Incentives/Incentive.ts +9 -1
- package/src/Incentives/PointsIncentive.test.ts +51 -0
- package/src/Incentives/PointsIncentive.ts +1 -1
- package/src/Validators/Validator.ts +3 -0
- package/src/index.ts +1 -0
- package/dist/componentInterfaces-dakxtQHf.js.map +0 -1
- package/dist/generated-BTslM7bf.js.map +0 -1
- package/dist/generated-DhXxTQ20.cjs +0 -3
- package/dist/generated-DhXxTQ20.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantManyRoles,\n simulateRbacGrantRoles,\n simulateRbacRevokeManyRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantManyRoles,\n writeRbacGrantRoles,\n writeRbacRevokeManyRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\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 writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(address: Address, role: Roles, params?: WriteParams) {\n return await this.awaitResult(this.grantRolesRaw(address, role, params));\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\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 writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.revokeRolesRaw(address, role, params));\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\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 writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.grantManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacGrantManyRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 writeRbacGrantManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.revokeManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacRevokeManyRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 writeRbacRevokeManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)\n * ```\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<Roles>>}\n */\n public async rolesOf(account: Address, params?: ReadParams) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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 return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(account: Address, roles: Roles, params?: ReadParams) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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\n /**\n * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(account: Address, roles: Roles, params?: ReadParams) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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\n /**\n * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(account: Address, params?: ReadParams) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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}\n"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","address","role","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","roles","simulateRbacGrantManyRoles","writeRbacGrantManyRoles","simulateRbacRevokeManyRoles","writeRbacRevokeManyRoles","account","readRbacRolesOf","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":";;;AA+BY,IAAAA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WAEAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SAJUA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,UAGHC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYvC,MAAa,cACXC,GACAC,GACAC,GACA;AACA,WAAO,MAAM,KAAK;AAAA,MAChB,KAAK,iBAAiBF,GAAWC,GAASC,CAAM;AAAA,IAAA;AAAA,EAEpD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAa,iBACXF,GACAC,GACAC,GACA;AACA,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAA,IAAW,MAAMC,EAA0B,KAAK,SAAS;AAAA,MACxE,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACL,GAAWC,CAAO;AAAA,MACzB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIC;AAAA,IAAA,CACL;AAEM,WAAA,EAAE,MADI,MAAMI,EAAuB,KAAK,SAASH,CAAO,GAChD,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAgBA,MAAa,WAAWG,GAAkBC,GAAaN,GAAsB;AACpE,WAA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AS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACJ,CAAO;AAAA,MACd,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIhB;AAAA,IAAA,CACL;AAAA,EACH;AACF;"}
|
|
1
|
+
{"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readOwnableRolesOwnershipHandoverExpiresAt,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateOwnableRolesCancelOwnershipHandover,\n simulateOwnableRolesCompleteOwnershipHandover,\n simulateOwnableRolesRenounceOwnership,\n simulateOwnableRolesRenounceRoles,\n simulateOwnableRolesRequestOwnershipHandover,\n simulateOwnableRolesTransferOwnership,\n simulateRbacGrantManyRoles,\n simulateRbacGrantRoles,\n simulateRbacRevokeManyRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeOwnableRolesCancelOwnershipHandover,\n writeOwnableRolesCompleteOwnershipHandover,\n writeOwnableRolesRenounceOwnership,\n writeOwnableRolesRenounceRoles,\n writeOwnableRolesRequestOwnershipHandover,\n writeOwnableRolesTransferOwnership,\n writeRbacGrantManyRoles,\n writeRbacGrantRoles,\n writeRbacRevokeManyRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\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 writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(address: Address, role: Roles, params?: WriteParams) {\n return await this.awaitResult(this.grantRolesRaw(address, role, params));\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\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 writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.revokeRolesRaw(address, role, params));\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\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 writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.grantManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacGrantManyRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 writeRbacGrantManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.revokeManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams,\n ) {\n const { request, result } = await simulateRbacRevokeManyRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, roles],\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 writeRbacRevokeManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)\n * ```\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<Roles>>}\n */\n public async rolesOf(account: Address, params?: ReadParams) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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 return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(account: Address, roles: Roles, params?: ReadParams) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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\n /**\n * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(account: Address, roles: Roles, params?: ReadParams) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\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\n /**\n * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(account: Address, params?: ReadParams) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\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\n /**\n * Transfer ownership of the contract to a new address\n *\n * @public\n * @async\n * @param {Address} newOwner - The address to transfer ownership to\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async transferOwnership(newOwner: Address, params?: WriteParams) {\n return await this.awaitResult(this.transferOwnershipRaw(newOwner, params));\n }\n\n /**\n * Transfer ownership of the contract to a new address\n *\n * @public\n * @async\n * @param {Address} newOwner - The address to transfer ownership to\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async transferOwnershipRaw(newOwner: Address, params?: WriteParams) {\n const { request, result } = await simulateOwnableRolesTransferOwnership(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [newOwner],\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 writeOwnableRolesTransferOwnership(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Renounce ownership of the contract\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async renounceOwnership(params?: WriteParams) {\n return await this.awaitResult(this.renounceOwnershipRaw(params));\n }\n\n /**\n * Renounce ownership of the contract\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async renounceOwnershipRaw(params?: WriteParams) {\n const { request, result } = await simulateOwnableRolesRenounceOwnership(\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 writeOwnableRolesRenounceOwnership(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Request a two-step ownership handover to the caller\n * The request will automatically expire in 48 hours\n *\n * Note: This is part of a two-step ownership transfer process:\n * 1. New owner calls requestOwnershipHandover()\n * 2. Current owner calls completeOwnershipHandover(newOwner)\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async requestOwnershipHandover(params?: WriteParams) {\n return await this.awaitResult(this.requestOwnershipHandoverRaw(params));\n }\n\n /**\n * Request a two-step ownership handover to the caller\n * The request will automatically expire in 48 hours\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async requestOwnershipHandoverRaw(params?: WriteParams) {\n const { request, result } =\n await simulateOwnableRolesRequestOwnershipHandover(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 });\n const hash = await writeOwnableRolesRequestOwnershipHandover(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Complete a pending ownership handover to a new owner\n * Must be called by the current owner after the new owner has requested the handover\n *\n * Note: This is part of a two-step ownership transfer process:\n * 1. New owner calls requestOwnershipHandover()\n * 2. Current owner calls completeOwnershipHandover(newOwner)\n *\n * @public\n * @async\n * @param {Address} pendingOwner - The address that requested the ownership handover\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async completeOwnershipHandover(\n pendingOwner: Address,\n params?: WriteParams,\n ) {\n return await this.awaitResult(\n this.completeOwnershipHandoverRaw(pendingOwner, params),\n );\n }\n\n /**\n * Complete a pending ownership handover to a new owner\n * Must be called by the current owner after the new owner has requested the handover\n *\n * @public\n * @async\n * @param {Address} pendingOwner - The address that requested the ownership handover\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async completeOwnershipHandoverRaw(\n pendingOwner: Address,\n params?: WriteParams,\n ) {\n const { request, result } =\n await simulateOwnableRolesCompleteOwnershipHandover(this._config, {\n address: this.assertValidAddress(),\n args: [pendingOwner],\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 writeOwnableRolesCompleteOwnershipHandover(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Cancel a pending ownership handover request\n * Must be called by the account that originally requested the handover\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async cancelOwnershipHandover(params?: WriteParams) {\n return await this.awaitResult(this.cancelOwnershipHandoverRaw(params));\n }\n\n /**\n * Cancel a pending ownership handover request\n * Must be called by the account that originally requested the handover\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async cancelOwnershipHandoverRaw(params?: WriteParams) {\n const { request, result } =\n await simulateOwnableRolesCancelOwnershipHandover(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 });\n const hash = await writeOwnableRolesCancelOwnershipHandover(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Get the expiry timestamp for a pending ownership handover\n * Returns 0 if there is no pending handover request for the given address\n *\n * @public\n * @param {Address} pendingOwner - The address to check for pending handover requests\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The timestamp when the handover request expires, or 0 if no request exists\n */\n public ownershipHandoverExpiresAt(\n pendingOwner: Address,\n params?: ReadParams,\n ): Promise<bigint> {\n return readOwnableRolesOwnershipHandoverExpiresAt(this._config, {\n address: this.assertValidAddress(),\n args: [pendingOwner],\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\n /**\n * Allow the caller to remove their own roles\n * If the caller does not have a role, then it will be a no-op for that role\n *\n * @public\n * @async\n * @param {Roles} roles - Bitmap of roles to renounce\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async renounceRoles(roles: Roles, params?: WriteParams) {\n return await this.awaitResult(this.renounceRolesRaw(roles, params));\n }\n\n /**\n * Allow the caller to remove their own roles\n * If the caller does not have a role, then it will be a no-op for that role\n *\n * @public\n * @async\n * @param {Roles} roles - Bitmap of roles to renounce\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async renounceRolesRaw(roles: Roles, params?: WriteParams) {\n const { request, result } = await simulateOwnableRolesRenounceRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [roles],\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 writeOwnableRolesRenounceRoles(this._config, request);\n return { hash, result };\n }\n}\n"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","address","role","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","roles","simulateRbacGrantManyRoles","writeRbacGrantManyRoles","simulateRbacRevokeManyRoles","writeRbacRevokeManyRoles","account","readRbacRolesOf","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized","newOwner","simulateOwnableRolesTransferOwnership","writeOwnableRolesTransferOwnership","simulateOwnableRolesRenounceOwnership","writeOwnableRolesRenounceOwnership","simulateOwnableRolesRequestOwnershipHandover","writeOwnableRolesRequestOwnershipHandover","pendingOwner","simulateOwnableRolesCompleteOwnershipHandover","writeOwnableRolesCompleteOwnershipHandover","simulateOwnableRolesCancelOwnershipHandover","writeOwnableRolesCancelOwnershipHandover","readOwnableRolesOwnershipHandoverExpiresAt","simulateOwnableRolesRenounceRoles","writeOwnableRolesRenounceRoles"],"mappings":";;;AA4CY,IAAAA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WAEAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SAJUA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,UAGHC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYv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AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWO,2BACL0B,GACA5B,GACiB;AACV,WAAAiC,EAA2C,KAAK,SAAS;AAAA,MAC9D,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACL,CAAY;AAAA,MACnB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAI5B;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,cAAcW,GAAcX,GAAsB;AAC7D,WAAO,MAAM,KAAK,YAAY,KAAK,iBAAiBW,GAAOX,CAAM,CAAC;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,iBAAiBW,GAAcX,GAAsB;AAChE,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAO,IAAI,MAAMgC;AAAAA,MAChC,KAAK;AAAA,MACL;AAAA,QACE,SAAS,KAAK,mBAAmB;AAAA,QACjC,MAAM,CAACvB,CAAK;AAAA,QACZ,GAAG,KAAK,wBAAwB;AAAA;AAAA,QAEhC,GAAIX;AAAA,MACN;AAAA,IAAA;AAGK,WAAA,EAAE,MADI,MAAMmC,EAA+B,KAAK,SAASlC,CAAO,GACxD,QAAAC;EACjB;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const a=require("./generated-D50hBWtr.cjs"),c=require("./componentInterfaces-Bt-4sNB5.cjs"),g=require("@wagmi/core"),y=require("./errors.cjs"),m=require("./Incentives/AllowListIncentive.cjs"),w=require("./Incentives/CGDAIncentive.cjs"),I=require("./Incentives/ERC20Incentive.cjs"),s=require("viem"),A=require("./deployments-BucJ-gwk.cjs"),C=require("./Deployable/DeployableTarget.cjs"),o=require("./claiming.cjs"),p=require("./utils.cjs"),v=require("./Incentives/ERC20VariableCriteriaIncentive.cjs"),l=require("./Incentives/ERC20VariableIncentive.cjs"),R=require("./Incentives/PointsIncentive.cjs"),V="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6127e6806100bd5f395ff3fe60806040526004361061020e575f3560e01c806354d1f13d11610117578063d54ad2a11161009f578063ec87621c1161006e578063ec87621c14610739578063f04e283e14610763578063f2fde38b1461077f578063fe9fbb801461079b578063fee81cf4146107d75761020e565b8063d54ad2a114610681578063db09da12146106ab578063dcc21361146106e7578063dcc59b6f1461070f5761020e565b80639214fa4d116100e65780639214fa4d1461058d578063a4d66daf146105b7578063bb1757cf146105e1578063be4994f81461061d578063c884ef83146106455761020e565b806354d1f13d14610525578063715018a61461052f57806375b238fc146105395780638da5cb5b146105635761020e565b80632de948071161019a578063474f5a4411610169578063474f5a441461042a5780634a4ee7b1146104675780634e7165a214610483578063514e62fc146104bf578063547d1864146104fb5761020e565b80632de948071461037457806338d52e0f146103b05780634359d28a146103da578063439fab91146104025761020e565b80631cd64df4116101e15780631cd64df4146102b05780631f1cb62b146102ec578063228cb73314610316578063256929621461034057806328d6183b1461034a5761020e565b806301ffc9a71461021257806307621eca1461024e578063183a4f6e146102785780631c10893f14610294575b5f80fd5b34801561021d575f80fd5b5061023860048036038101906102339190611ab3565b610813565b6040516102459190611af8565b60405180910390f35b348015610259575f80fd5b5061026261088c565b60405161026f9190611b29565b60405180910390f35b610292600480360381019061028d9190611b6c565b610894565b005b6102ae60048036038101906102a99190611bf1565b6108a1565b005b3480156102bb575f80fd5b506102d660048036038101906102d19190611bf1565b6108b7565b6040516102e39190611af8565b60405180910390f35b3480156102f7575f80fd5b506103006108cd565b60405161030d9190611c3e565b60405180910390f35b348015610321575f80fd5b5061032a6108f2565b6040516103379190611b29565b60405180910390f35b6103486108f7565b005b348015610355575f80fd5b5061035e610948565b60405161036b9190611c66565b60405180910390f35b34801561037f575f80fd5b5061039a60048036038101906103959190611c7f565b61096f565b6040516103a79190611b29565b60405180910390f35b3480156103bb575f80fd5b506103c4610988565b6040516103d19190611c3e565b60405180910390f35b3480156103e5575f80fd5b5061040060048036038101906103fb9190611d60565b6109ad565b005b34801561040d575f80fd5b5061042860048036038101906104239190611e33565b610abb565b005b348015610435575f80fd5b50610450600480360381019061044b9190611e33565b610d45565b60405161045e929190611e7e565b60405180910390f35b610481600480360381019061047c9190611bf1565b610eaf565b005b34801561048e575f80fd5b506104a960048036038101906104a49190611e33565b610ec5565b6040516104b69190611f15565b60405180910390f35b3480156104ca575f80fd5b506104e560048036038101906104e09190611bf1565b610f9a565b6040516104f29190611af8565b60405180910390f35b348015610506575f80fd5b5061050f610fb1565b60405161051c9190611b29565b60405180910390f35b61052d610fb7565b005b610537610ff0565b005b348015610544575f80fd5b5061054d611003565b60405161055a9190611b29565b60405180910390f35b34801561056e575f80fd5b50610577611008565b6040516105849190611c3e565b60405180910390f35b348015610598575f80fd5b506105a1611030565b6040516105ae9190611c3e565b60405180910390f35b3480156105c2575f80fd5b506105cb611058565b6040516105d89190611b29565b60405180910390f35b3480156105ec575f80fd5b5061060760048036038101906106029190611f35565b61105e565b6040516106149190611af8565b60405180910390f35b348015610628575f80fd5b50610643600480360381019061063e9190611fe7565b611239565b005b348015610650575f80fd5b5061066b60048036038101906106669190611c7f565b6112ef565b6040516106789190611af8565b60405180910390f35b34801561068c575f80fd5b5061069561130c565b6040516106a29190611b29565b60405180910390f35b3480156106b6575f80fd5b506106d160048036038101906106cc9190611f35565b611312565b6040516106de9190611af8565b60405180910390f35b3480156106f2575f80fd5b5061070d60048036038101906107089190611fe7565b611355565b005b34801561071a575f80fd5b5061072361140b565b6040516107309190611b29565b60405180910390f35b348015610744575f80fd5b5061074d611411565b60405161075a9190611b29565b60405180910390f35b61077d60048036038101906107789190611c7f565b611416565b005b61079960048036038101906107949190611c7f565b611454565b005b3480156107a6575f80fd5b506107c160048036038101906107bc9190611c7f565b61147d565b6040516107ce9190611af8565b60405180910390f35b3480156107e2575f80fd5b506107fd60048036038101906107f89190611c7f565b6114d0565b60405161080a9190611b29565b60405180910390f35b5f7f56586338000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806108855750610884826114e9565b5b9050919050565b5f8054905090565b61089e3382611562565b50565b6108a9611571565b6108b382826115a8565b5050565b5f81826108c38561096f565b1614905092915050565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f5481565b5f6109006115b8565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f5658633800000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b60035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026109b8816115c2565b8282905085859050146109f7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610ab3575f848483818110610a1857610a17612065565b5b9050602002016020810190610a2d91906120bc565b90506001151581151503610a7257610a6d878784818110610a5157610a50612065565b5b9050602002016020810190610a669190611c7f565b60016115a8565b610aa5565b610aa4878784818110610a8857610a87612065565b5b9050602002016020810190610a9d9190611c7f565b6001611562565b5b5080806001019150506109f9565b505050505050565b5f610ac46115f7565b90508054600382558015610af65760018160011c14303b10610aed5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610b0791906121f0565b90505f81604001511480610b1e57505f8160600151145b15610b55576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f816060015190505f610b8a30845f015173ffffffffffffffffffffffffffffffffffffffff1661162090919063ffffffff16565b905081811015610bd857825f015181836040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610bcf9392919061221b565b60405180910390fd5b825f015160035f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826020015160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082604001515f819055508260600151600581905550610c7d33611653565b610c8c83608001516001611729565b826020015173ffffffffffffffffffffffffffffffffffffffff16835f015173ffffffffffffffffffffffffffffffffffffffff167fd20715546497e6d32bc9b61b35416a25a8cc41d2fb7f389a1bb26dc040213a3b856040015186606001518760800151604051610d0093929190612250565b60405180910390a35050508015610d40576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610d528161176a565b5f8585810190610d62919061239e565b90505f8160200151806020019051810190610d7d91906123f9565b90508060055f828254610d909190612451565b92505081905550610de6825f01518260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117919092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610e5a939291906124e9565b604051602081830303815290604052604051610e769190611f15565b60405180910390a28060035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094505050509250929050565b610eb7611571565b610ec18282611562565b5050565b60605f8383810190610ed791906121f0565b90505f81606001519050604051806080016040528060016002811115610f0057610eff612525565b5b8152602001835f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610f5f919061257b565b604051602081830303815290604052815250604051602001610f819190612691565b6040516020818303038152906040529250505092915050565b5f8082610fa68561096f565b161415905092915050565b60025481565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610ff8611571565b6110015f6117da565b565b600281565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b60055481565b5f611067611571565b5f83838101906110779190612736565b90505f816020015180602001905181019061109291906123f9565b905061109e86826118a0565b6110d4576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600554816006546110e5919061277d565b111561111d576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060065f82825461112e919061277d565b92505081905550600160045f828254611147919061277d565b9250508190555061119a868260035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166117919092919063ffffffff16565b8573ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360035f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff168884604051602001611208939291906124e9565b6040516020818303038152906040526040516112249190611f15565b60405180910390a26001925050509392505050565b6002611244816115c2565b828290508585905014611283576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156112e7576112da8686838181106112a6576112a5612065565b5b90506020020160208101906112bb9190611c7f565b8585848181106112ce576112cd612065565b5b905060200201356115a8565b8080600101915050611285565b505050505050565b6001602052805f5260405f205f915054906101000a900460ff1681565b60065481565b5f8083838101906113239190612736565b90505f816020015180602001905181019061133e91906123f9565b905061134a86826118a0565b925050509392505050565b6002611360816115c2565b82829050858590501461139f576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015611403576113f68686838181106113c2576113c1612065565b5b90506020020160208101906113d79190611c7f565b8585848181106113ea576113e9612065565b5b90506020020135611562565b80806001019150506113a1565b505050505050565b60045481565b600181565b61141e611571565b63389a75e1600c52805f526020600c20805442111561144457636f5e88185f526004601cfd5b5f815550611451816117da565b50565b61145c611571565b8060601b61147157637448fbae5f526004601cfd5b61147a816117da565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff1661149d611008565b73ffffffffffffffffffffffffffffffffffffffff1614806114c957506114c8826002600117610f9a565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061155b575061155a8261190f565b5b9050919050565b61156d82825f611988565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275433146115a6576382b429005f526004601cfd5b565b6115b482826001611988565b5050565b5f6202a300905090565b638b78c6d8195433146115f457638b78c6d8600c52335f52806020600c2054166115f3576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b61165b6119e0565b156116d3577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392780541561169557630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350611726565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b638b78c6d8600c52335f52806020600c20541661178e576382b429005f526004601cfd5b50565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f511417166117d1576390b8ec185f526004601cfd5b5f603452505050565b6117e26119e0565b15611847577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b821781555061189d565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f60015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611907575060055482600654611904919061277d565b11155b905092915050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806119815750611980826119e4565b5b9050919050565b638b78c6d8600c52825f526020600c208054838117836119aa57848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a9281611a5e565b8114611a9c575f80fd5b50565b5f81359050611aad81611a89565b92915050565b5f60208284031215611ac857611ac7611a56565b5b5f611ad584828501611a9f565b91505092915050565b5f8115159050919050565b611af281611ade565b82525050565b5f602082019050611b0b5f830184611ae9565b92915050565b5f819050919050565b611b2381611b11565b82525050565b5f602082019050611b3c5f830184611b1a565b92915050565b611b4b81611b11565b8114611b55575f80fd5b50565b5f81359050611b6681611b42565b92915050565b5f60208284031215611b8157611b80611a56565b5b5f611b8e84828501611b58565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611bc082611b97565b9050919050565b611bd081611bb6565b8114611bda575f80fd5b50565b5f81359050611beb81611bc7565b92915050565b5f8060408385031215611c0757611c06611a56565b5b5f611c1485828601611bdd565b9250506020611c2585828601611b58565b9150509250929050565b611c3881611bb6565b82525050565b5f602082019050611c515f830184611c2f565b92915050565b611c6081611a5e565b82525050565b5f602082019050611c795f830184611c57565b92915050565b5f60208284031215611c9457611c93611a56565b5b5f611ca184828501611bdd565b91505092915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611ccb57611cca611caa565b5b8235905067ffffffffffffffff811115611ce857611ce7611cae565b5b602083019150836020820283011115611d0457611d03611cb2565b5b9250929050565b5f8083601f840112611d2057611d1f611caa565b5b8235905067ffffffffffffffff811115611d3d57611d3c611cae565b5b602083019150836020820283011115611d5957611d58611cb2565b5b9250929050565b5f805f8060408587031215611d7857611d77611a56565b5b5f85013567ffffffffffffffff811115611d9557611d94611a5a565b5b611da187828801611cb6565b9450945050602085013567ffffffffffffffff811115611dc457611dc3611a5a565b5b611dd087828801611d0b565b925092505092959194509250565b5f8083601f840112611df357611df2611caa565b5b8235905067ffffffffffffffff811115611e1057611e0f611cae565b5b602083019150836001820283011115611e2c57611e2b611cb2565b5b9250929050565b5f8060208385031215611e4957611e48611a56565b5b5f83013567ffffffffffffffff811115611e6657611e65611a5a565b5b611e7285828601611dde565b92509250509250929050565b5f604082019050611e915f830185611b1a565b611e9e6020830184611c2f565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611ee782611ea5565b611ef18185611eaf565b9350611f01818560208601611ebf565b611f0a81611ecd565b840191505092915050565b5f6020820190508181035f830152611f2d8184611edd565b905092915050565b5f805f60408486031215611f4c57611f4b611a56565b5b5f611f5986828701611bdd565b935050602084013567ffffffffffffffff811115611f7a57611f79611a5a565b5b611f8686828701611dde565b92509250509250925092565b5f8083601f840112611fa757611fa6611caa565b5b8235905067ffffffffffffffff811115611fc457611fc3611cae565b5b602083019150836020820283011115611fe057611fdf611cb2565b5b9250929050565b5f805f8060408587031215611fff57611ffe611a56565b5b5f85013567ffffffffffffffff81111561201c5761201b611a5a565b5b61202887828801611cb6565b9450945050602085013567ffffffffffffffff81111561204b5761204a611a5a565b5b61205787828801611f92565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b61209b81611ade565b81146120a5575f80fd5b50565b5f813590506120b681612092565b92915050565b5f602082840312156120d1576120d0611a56565b5b5f6120de848285016120a8565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61212182611ecd565b810181811067ffffffffffffffff821117156121405761213f6120eb565b5b80604052505050565b5f612152611a4d565b905061215e8282612118565b919050565b5f80fd5b5f60a0828403121561217c5761217b6120e7565b5b61218660a0612149565b90505f61219584828501611bdd565b5f8301525060206121a884828501611bdd565b60208301525060406121bc84828501611b58565b60408301525060606121d084828501611b58565b60608301525060806121e484828501611bdd565b60808301525092915050565b5f60a0828403121561220557612204611a56565b5b5f61221284828501612167565b91505092915050565b5f60608201905061222e5f830186611c2f565b61223b6020830185611b1a565b6122486040830184611b1a565b949350505050565b5f6060820190506122635f830186611b1a565b6122706020830185611b1a565b61227d6040830184611c2f565b949350505050565b5f80fd5b5f67ffffffffffffffff8211156122a3576122a26120eb565b5b6122ac82611ecd565b9050602081019050919050565b828183375f83830152505050565b5f6122d96122d484612289565b612149565b9050828152602081018484840111156122f5576122f4612285565b5b6123008482856122b9565b509392505050565b5f82601f83011261231c5761231b611caa565b5b813561232c8482602086016122c7565b91505092915050565b5f6040828403121561234a576123496120e7565b5b6123546040612149565b90505f61236384828501611bdd565b5f83015250602082013567ffffffffffffffff81111561238657612385612163565b5b61239284828501612308565b60208301525092915050565b5f602082840312156123b3576123b2611a56565b5b5f82013567ffffffffffffffff8111156123d0576123cf611a5a565b5b6123dc84828501612335565b91505092915050565b5f815190506123f381611b42565b92915050565b5f6020828403121561240e5761240d611a56565b5b5f61241b848285016123e5565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f61245b82611b11565b915061246683611b11565b925082820390508181111561247e5761247d612424565b5b92915050565b5f8160601b9050919050565b5f61249a82612484565b9050919050565b5f6124ab82612490565b9050919050565b6124c36124be82611bb6565b6124a1565b82525050565b5f819050919050565b6124e36124de82611b11565b6124c9565b82525050565b5f6124f482866124b2565b60148201915061250482856124b2565b60148201915061251482846124d2565b602082019150819050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b61255b81611b11565b82525050565b602082015f8201516125755f850182612552565b50505050565b5f60208201905061258e5f830184612561565b92915050565b600381106125a5576125a4612525565b5b50565b5f8190506125b582612594565b919050565b5f6125c4826125a8565b9050919050565b6125d4816125ba565b82525050565b6125e381611bb6565b82525050565b5f82825260208201905092915050565b5f61260382611ea5565b61260d81856125e9565b935061261d818560208601611ebf565b61262681611ecd565b840191505092915050565b5f608083015f8301516126465f8601826125cb565b50602083015161265960208601826125da565b50604083015161266c60408601826125da565b506060830151848203606086015261268482826125f9565b9150508091505092915050565b5f6020820190508181035f8301526126a98184612631565b905092915050565b5f604082840312156126c6576126c56120e7565b5b6126d06040612149565b90505f82013567ffffffffffffffff8111156126ef576126ee612163565b5b6126fb84828501612308565b5f83015250602082013567ffffffffffffffff81111561271e5761271d612163565b5b61272a84828501612308565b60208301525092915050565b5f6020828403121561274b5761274a611a56565b5b5f82013567ffffffffffffffff81111561276857612767611a5a565b5b612774848285016126b1565b91505092915050565b5f61278782611b11565b915061279283611b11565b92508282019050808211156127aa576127a9612424565b5b9291505056fea26469706673582212202beefdd32df0168ac2dac98d82b522781beec2d4ca4f57cad53a6f4a313ab35164736f6c634300081a0033",i=class i extends C.DeployableTarget{constructor(){super(...arguments),this.abi=a.f}async owner(f){return await a.eg(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return await a.ZI(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a.WI(this._config,{address:this.assertValidAddress(),args:[],...f})}async totalClaimed(f){return await a.pg(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.UI(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.GI(this._config,{address:this.assertValidAddress(),...f})}async peg(f){return await a.ng(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return await a.ig(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return await a.YI(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.Rg(this._config,{address:this.assertValidAddress(),args:[o.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.yg(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.Og(this._config,{address:this.assertValidAddress(),args:[o.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.dg(this._config,e),result:d}}async isClaimable(f,b){return await a.XI(this._config,{address:this.assertValidAddress(),args:[f.target,f.data],...b})}async getPeg(f){return await a.$I(this._config,{address:this.assertValidAddress(),args:[],...f})}async getTotalBudget(f){return await this.limit(f)}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.claims(f),this.limit(f)]);return e-b}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.f,bytecode:V,args:[u(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return s.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return s.zeroHash}};i.bases={31337:void 0,...A.ERC20Incentive},i.registryType=p.RegistryType.INCENTIVE;let r=i;function u({asset:t,peg:f,reward:b,limit:e,manager:d=s.zeroAddress}){return s.encodeAbiParameters([{type:"address",name:"asset"},{type:"address",name:"peg"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"address",name:"manager"}],[t,f,b,e,d])}const n={[c.APointsIncentive]:R.PointsIncentive,[c.AERC20Incentive]:I.ERC20Incentive,[c.AERC20VariableIncentive]:l.ERC20VariableIncentive,[c.AAllowListIncentive]:m.AllowListIncentive,[c.ACGDAIncentive]:w.CGDAIncentive,[c.AERC20VariableIncentive]:l.ERC20VariableIncentive,[c.AERC20VariableCriteriaIncentive]:v.ERC20VariableCriteriaIncentive};async function q(t,f,b){const e=await g.readContract(t.config,{abi:a.K,functionName:"getComponentInterface",address:f,...b}),d=n[e];if(!d)throw new y.InvalidComponentInterfaceError(Object.keys(n),e);return new d(t,f)}exports.ERC20PeggedIncentive=r;exports.IncentiveByComponentInterface=n;exports.incentiveFromAddress=q;exports.prepareERC20PeggedIncentivePayload=u;
|
|
2
|
+
//# sourceMappingURL=Incentive-CfIjdL4T.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive-CfIjdL4T.cjs","sources":["../src/Incentives/ERC20PeggedIncentive.ts","../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20PeggedIncentiveAbi,\n readErc20PeggedIncentiveAsset,\n readErc20PeggedIncentiveClaimed,\n readErc20PeggedIncentiveClaims,\n readErc20PeggedIncentiveCurrentReward,\n readErc20PeggedIncentiveGetPeg,\n readErc20PeggedIncentiveIsClaimable,\n readErc20PeggedIncentiveLimit,\n readErc20PeggedIncentiveOwner,\n readErc20PeggedIncentivePeg,\n readErc20PeggedIncentiveReward,\n readErc20PeggedIncentiveTotalClaimed,\n simulateErc20PeggedIncentiveClaim,\n simulateErc20PeggedIncentiveClawback,\n writeErc20PeggedIncentiveClaim,\n writeErc20PeggedIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedIncentive.sol/ERC20PeggedIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20PeggedIncentiveAbi };\n\n/**\n * The object representation of a `ERC20PeggedIncentive.InitPayload`\n *\n * @export\n * @interface ERC20PeggedIncentivePayload\n * @typedef {ERC20PeggedIncentivePayload}\n */\nexport interface ERC20PeggedIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20PeggedIncentive` event types.\n *\n * @export\n * @typedef {ERC20PeggedIncentiveLog}\n * @template {ContractEventName<typeof erc20PeggedIncentiveAbi>} [event=ContractEventName<\n * typeof erc20PeggedIncentiveAbi\n * >]\n */\nexport type ERC20PeggedIncentiveLog<\n event extends ContractEventName<\n typeof erc20PeggedIncentiveAbi\n > = ContractEventName<typeof erc20PeggedIncentiveAbi>,\n> = GenericLog<typeof erc20PeggedIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20PeggedIncentive\n * @typedef {ERC20PeggedIncentive}\n * @extends {DeployableTarget<ERC20PeggedIncentivePayload>}\n */\nexport class ERC20PeggedIncentive extends DeployableTarget<\n ERC20PeggedIncentivePayload,\n typeof erc20PeggedIncentiveAbi\n> {\n public override readonly abi = erc20PeggedIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20IncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedIncentiveClaims(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 total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedIncentiveTotalClaimed(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} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedIncentiveClaimed(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} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedIncentivePeg(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedIncentiveReward(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 possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClaim(\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 writeErc20PeggedIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClawback(\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 writeErc20PeggedIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedIncentiveGetPeg(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 maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as ERC20PeggedIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because ERC20PeggedIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedIncentivePayload}, properly encode a `ERC20PeggedIncentive.InitPayload` for use with {@link ERC20PeggedIncentive} initialization.\n *\n * @param {ERC20PeggedIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedIncentivePayload({\n asset,\n peg,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20PeggedIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [asset, peg, reward, limit, manager],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20PeggedIncentive,\n AERC20VariableCriteriaIncentive,\n AERC20VariableIncentive,\n // AERC20VariableCriteriaIncentive\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 type { ReadParams } from '../utils';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20PeggedIncentive } from './ERC20PeggedIncentive';\nimport { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n ERC20PeggedIncentive,\n PointsIncentive,\n ERC20VariableIncentive,\n ERC20VariableCriteriaIncentive,\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 | ERC20PeggedIncentive\n | PointsIncentive\n | ERC20VariableIncentive\n | ERC20VariableCriteriaIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x4414fbb4\": typeof ERC20PeggedIncentive; \"0x56586338\" typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0xa8e4af1e\": typeof ERC20VariableIncentive; \"0x90318111\": typeof ERC20VariableCriteriaIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n [AAllowListIncentive]: AllowListIncentive,\n // [AERC1155Incentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n [AERC20VariableCriteriaIncentive as Hex]: ERC20VariableCriteriaIncentive,\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 {Incentive}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n params?: ReadParams,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n ...params,\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":["_ERC20PeggedIncentive","DeployableTarget","erc20PeggedIncentiveAbi","params","readErc20PeggedIncentiveOwner","readErc20PeggedIncentiveCurrentReward","readErc20PeggedIncentiveClaims","readErc20PeggedIncentiveTotalClaimed","address","readErc20PeggedIncentiveClaimed","readErc20PeggedIncentiveAsset","readErc20PeggedIncentivePeg","readErc20PeggedIncentiveReward","readErc20PeggedIncentiveLimit","payload","request","result","simulateErc20PeggedIncentiveClaim","prepareClaimPayload","writeErc20PeggedIncentiveClaim","simulateErc20PeggedIncentiveClawback","writeErc20PeggedIncentiveClawback","readErc20PeggedIncentiveIsClaimable","readErc20PeggedIncentiveGetPeg","claims","limit","_payload","_options","options","bytecode","prepareERC20PeggedIncentivePayload","amount","encodeAbiParameters","zeroHash","ERC20IncentiveBases","RegistryType","ERC20PeggedIncentive","asset","peg","reward","manager","zeroAddress","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AERC20VariableIncentive","ERC20VariableIncentive","AAllowListIncentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableCriteriaIncentive","ERC20VariableCriteriaIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":"i7pBA2GaA,EAAN,MAAMA,UAA6BC,EAAAA,gBAGxC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAA8B,KAAK,QAAS,CACvD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,cAAcA,EAAqB,CACvC,OAAA,MAAME,EAAAA,GAAsC,KAAK,QAAS,CAC/D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAMG,EAAAA,GAA+B,KAAK,QAAS,CACxD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAUA,MAAa,aAAaA,EAAqB,CACtC,OAAA,MAAMI,EAAAA,GAAqC,KAAK,QAAS,CAC9D,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIJ,CAAA,CACL,CACH,CAWA,MAAa,QAAQK,EAAkBL,EAAqB,CACnD,OAAA,MAAMM,EAAAA,GAAgC,KAAK,QAAS,CACzD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EAEd,GAAIL,CAAA,CACL,CACH,CAUA,MAAa,MAAMA,EAAqB,CAC/B,OAAA,MAAMO,EAAAA,GAA8B,KAAK,QAAS,CACvD,QAAS,KAAK,mBAAmB,EAEjC,GAAIP,CAAA,CACL,CACH,CAUA,MAAa,IAAIA,EAAqB,CAC7B,OAAA,MAAMQ,EAAAA,GAA4B,KAAK,QAAS,CACrD,QAAS,KAAK,mB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