@boostxyz/sdk 0.0.0-alpha.5 → 0.0.0-alpha.7
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 -0
- package/dist/Actions/Action.cjs.map +1 -0
- package/dist/Actions/Action.js +1 -0
- package/dist/Actions/Action.js.map +1 -0
- package/dist/Actions/EventAction.cjs +2 -1
- package/dist/Actions/EventAction.cjs.map +1 -0
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +39 -40
- package/dist/Actions/EventAction.js.map +1 -0
- package/dist/AllowLists/AllowList.cjs +1 -0
- package/dist/AllowLists/AllowList.cjs.map +1 -0
- package/dist/AllowLists/AllowList.js +1 -0
- 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 +1 -0
- package/dist/Budgets/Budget.cjs.map +1 -0
- package/dist/Budgets/Budget.js +1 -0
- 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 +1 -0
- package/dist/Incentives/Incentive.cjs.map +1 -0
- package/dist/Incentives/Incentive.js +1 -0
- 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 +1 -0
- package/dist/Validators/Validator.cjs.map +1 -0
- package/dist/Validators/Validator.js +1 -0
- package/dist/Validators/Validator.js.map +1 -0
- package/dist/componentInterfaces-CKCBwG16.cjs +1 -0
- package/dist/componentInterfaces-CKCBwG16.cjs.map +1 -0
- package/dist/componentInterfaces-DYkaxBda.js +1 -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.js +1 -0
- package/dist/utils.js.map +1 -0
- package/package.json +3 -2
- 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 +380 -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":"ManagedBudget.js","sources":["../../src/Budgets/ManagedBudget.ts"],"sourcesContent":["import {\n managedBudgetAbi,\n readManagedBudgetAvailable,\n readManagedBudgetDistributed,\n readManagedBudgetHasAllRoles,\n readManagedBudgetHasAnyRole,\n readManagedBudgetIsAuthorized,\n readManagedBudgetOwner,\n readManagedBudgetRolesOf,\n readManagedBudgetTotal,\n simulateManagedBudgetAllocate,\n simulateManagedBudgetClawback,\n simulateManagedBudgetDisburse,\n simulateManagedBudgetDisburseBatch,\n simulateManagedBudgetGrantRoles,\n simulateManagedBudgetRevokeRoles,\n simulateManagedBudgetSetAuthorized,\n writeManagedBudgetAllocate,\n writeManagedBudgetClawback,\n writeManagedBudgetDisburse,\n writeManagedBudgetDisburseBatch,\n writeManagedBudgetGrantRoles,\n writeManagedBudgetRevokeRoles,\n writeManagedBudgetSetAuthorized,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/budgets/ManagedBudget.sol/ManagedBudget.json';\nimport { getAccount } from '@wagmi/core';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n zeroAddress,\n} from 'viem';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n DeployableUnknownOwnerProvidedError,\n UnknownTransferPayloadSupplied,\n} from '../errors';\nimport {\n type ERC1155TransferPayload,\n type FungibleTransferPayload,\n type GenericLog,\n type ManagedBudgetPayload,\n type ReadParams,\n RegistryType,\n type WriteParams,\n prepareERC1155Transfer,\n prepareFungibleTransfer,\n prepareManagedBudgetPayload,\n} from '../utils';\n\nexport { managedBudgetAbi };\nexport type {\n ERC1155TransferPayload,\n FungibleTransferPayload,\n ManagedBudgetPayload,\n};\n\n/**\n * Enum representing available roles for use in the `ManagedBudget`.\n * `MANAGER` can disburse funds.\n * `ADMIN` can additionally manage authorized users on the budget.\n *\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n */\nexport const ManagedBudgetRoles = {\n MANAGER: 1n,\n ADMIN: 2n,\n} as const;\n\n/**\n * A generic `viem.Log` event with support for `ManagedBudget` event types.\n *\n * @export\n * @typedef {ManagedBudgetLog}\n * @template {ContractEventName<typeof managedBudgetAbi>} [event=ContractEventName<\n * typeof managedBudgetAbi\n * >]\n */\nexport type ManagedBudgetLog<\n event extends ContractEventName<typeof managedBudgetAbi> = ContractEventName<\n typeof managedBudgetAbi\n >,\n> = GenericLog<typeof managedBudgetAbi, event>;\n\n/**\n * Typeguard to determine if a transfer payload is a Fungible Transfer\n *\n * @export\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @returns {transfer is FungibleTransferPayload}\n */\nexport function isFungibleTransfer(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n): transfer is FungibleTransferPayload {\n return (transfer as ERC1155TransferPayload).tokenId === undefined;\n}\n\n/**\n * Typeguard to determine if a transfer payload is an ERC1155 Transfer\n *\n * @export\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @returns {transfer is ERC1155TransferPayload}\n */\nexport function isERC1155TransferPayload(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n): transfer is ERC1155TransferPayload {\n return (transfer as ERC1155TransferPayload).tokenId !== undefined;\n}\n\n/**\n * Given either a Fungible transfer, or ERC1155 transfer, will properly encode parameters for transfers, claims, disbursements, allocations, etc.\n *\n * @export\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @returns {*}\n * @throws {@link UnknownTransferPayloadSupplied}\n */\nexport function prepareTransfer(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n) {\n if (isFungibleTransfer(transfer)) {\n return prepareFungibleTransfer(transfer);\n } else if (isERC1155TransferPayload(transfer)) {\n return prepareERC1155Transfer(transfer);\n } else throw new UnknownTransferPayloadSupplied(transfer);\n}\n\n/**\n * A minimal budget implementation that simply holds and distributes tokens (ERC20-like and native)\n * This type of budget supports ETH, ERC20, and ERC1155 assets only\n *\n * @export\n * @class ManagedBudget\n * @typedef {ManagedBudget}\n * @extends {DeployableTarget<ManagedBudgetPayload>}\n */\nexport class ManagedBudget extends DeployableTarget<\n ManagedBudgetPayload,\n typeof managedBudgetAbi\n> {\n /**\n * @inheritdoc\n *\n * @public\n * @readonly\n * @type {*}\n */\n public override readonly abi = managedBudgetAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Address}\n */\n public static override base: Address = import.meta.env\n .VITE_MANAGED_BUDGET_BASE;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.BUDGET;\n\n /**\n * Allocates assets to the budget.\n * The caller must have already approved the contract to transfer the asset\n * If the asset transfer fails, the allocation will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'allocate'>} [params]\n * @returns {Promise<boolean>} - True if the allocation was successful\n */\n public async allocate(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'allocate'>,\n ) {\n return this.awaitResult(this.allocateRaw(transfer, params));\n }\n\n /**\n * Allocates assets to the budget.\n * The caller must have already approved the contract to transfer the asset\n * If the asset transfer fails, the allocation will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'allocate'>} [params]\n * @returns {Promise<boolean>} - True if the allocation was successful\n */\n public async allocateRaw(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'allocate'>,\n ) {\n const { request, result } = await simulateManagedBudgetAllocate(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareTransfer(transfer)],\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 writeManagedBudgetAllocate(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawbacks assets from the budget.\n * Only the owner can directly clawback assets from the budget\n * If the amount is zero, the entire balance of the asset will be transferred to the receiver\n * If the asset transfer fails, the reclamation will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the request was successful\n */\n public async clawback(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'clawback'>,\n ) {\n return this.awaitResult(this.clawbackRaw(transfer, params));\n }\n\n /**\n * Clawbacks assets from the budget.\n * Only the owner can directly clawback assets from the budget\n * If the amount is zero, the entire balance of the asset will be transferred to the receiver\n * If the asset transfer fails, the reclamation will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'clawback'>} [params]\n * @returns {Promise<boolean>} - True if the request was successful\n */\n public async clawbackRaw(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateManagedBudgetClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareTransfer(transfer)],\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 writeManagedBudgetClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Disburses assets from the budget to a single recipient\n * If the asset transfer fails, the disbursement will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'disburse'>} [params]\n * @returns {Promise<boolean>} - True if the disbursement was successful\n */\n public async disburse(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'disburse'>,\n ) {\n return this.awaitResult(this.disburseRaw(transfer, params));\n }\n\n /**\n * Disburses assets from the budget to a single recipient\n * If the asset transfer fails, the disbursement will revert\n *\n * @public\n * @async\n * @param {(FungibleTransferPayload | ERC1155TransferPayload)} transfer\n * @param {?WriteParams<typeof managedBudgetAbi, 'disburse'>} [params]\n * @returns {Promise<boolean>} - True if the disbursement was successful\n */\n public async disburseRaw(\n transfer: FungibleTransferPayload | ERC1155TransferPayload,\n params?: WriteParams<typeof managedBudgetAbi, 'disburse'>,\n ) {\n const { request, result } = await simulateManagedBudgetDisburse(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareTransfer(transfer)],\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 writeManagedBudgetDisburse(this._config, request);\n return { hash, result };\n }\n\n /**\n * Disburses assets from the budget to multiple recipients\n *\n * @public\n * @async\n * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers\n * @param {?WriteParams<typeof managedBudgetAbi, 'disburseBatch'>} [params]\n * @returns {Promise<boolean>} - True if all disbursements were successful\n */\n public async disburseBatch(\n transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,\n params?: WriteParams<typeof managedBudgetAbi, 'disburseBatch'>,\n ) {\n return this.awaitResult(this.disburseBatchRaw(transfers, params));\n }\n\n /**\n * Disburses assets from the budget to multiple recipients\n *\n * @public\n * @async\n * @param {Array<FungibleTransferPayload | ERC1155TransferPayload>} transfers\n * @param {?WriteParams<typeof managedBudgetAbi, 'disburseBatch'>} [params]\n * @returns {Promise<boolean>} - True if all disbursements were successful\n */\n public async disburseBatchRaw(\n transfers: Array<FungibleTransferPayload | ERC1155TransferPayload>,\n params?: WriteParams<typeof managedBudgetAbi, 'disburseBatch'>,\n ) {\n const { request, result } = await simulateManagedBudgetDisburseBatch(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [transfers.map(prepareTransfer)],\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 writeManagedBudgetDisburseBatch(this._config, request);\n return { hash, result };\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<typeof managedBudgetAbi, 'setAuthorized'>} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,\n ) {\n return this.awaitResult(this.setAuthorizedRaw(addresses, allowed, params));\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<typeof managedBudgetAbi, 'setAuthorized'>} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof managedBudgetAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateManagedBudgetSetAuthorized(\n this._config,\n {\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 );\n const hash = await writeManagedBudgetSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the budget.\n *\n * @example\n * ```ts\n * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {bigint[]} roles\n * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRoles(\n addresses: Address[],\n roles: bigint[],\n params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,\n ) {\n return this.awaitResult(this.grantRolesRaw(addresses, roles, params));\n }\n\n /**\n * Grant many accounts permissions on the budget.\n *\n * @example\n * ```ts\n * await budget.grantRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {bigint[]} roles\n * @param {?WriteParams<typeof managedBudgetAbi, 'grantRoles'>} [params]\n * @returns {unknown}\n */\n public async grantRolesRaw(\n addresses: Address[],\n roles: bigint[],\n params?: WriteParams<typeof managedBudgetAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateManagedBudgetGrantRoles(\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 writeManagedBudgetGrantRoles(\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 budget.\n *\n * @example\n * ```ts\n * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])\n *\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {bigint[]} roles\n * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRoles(\n addresses: Address[],\n roles: bigint[],\n params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,\n ) {\n return this.awaitResult(this.revokeRolesRaw(addresses, roles, params));\n }\n\n /**\n * Revoke many accounts' permissions on the budget.\n *\n * @example\n * ```ts\n * await budget.revokeRoles(['0xfoo', '0xbar], [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN])\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {bigint[]} roles\n * @param {?WriteParams<typeof managedBudgetAbi, 'revokeRoles'>} [params]\n * @returns {unknown}\n */\n public async revokeRolesRaw(\n addresses: Address[],\n roles: bigint[],\n params?: WriteParams<typeof managedBudgetAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateManagedBudgetRevokeRoles(\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 writeManagedBudgetRevokeRoles(\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 budget.rolesOf(0xfoo)).includes(ManagedBudgetRoles.ADMIN)\n * @public\n * @param {Address} account\n * @param {?ReadParams<typeof managedBudgetAbi, 'rolesOf'>} [params]\n * @returns {Promise<Array<bigint>>}\n */\n public async rolesOf(\n account: Address,\n params?: ReadParams<typeof managedBudgetAbi, 'rolesOf'>,\n ) {\n const roles = await readManagedBudgetRolesOf(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 [ManagedBudgetRoles.MANAGER, ManagedBudgetRoles.ADMIN].filter(\n (role) => (roles & role) === role,\n );\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await budget.hasAnyRole(0xfoo, ManagedBudgetRoles.ADMIN | ManagedBudgetRoles.MANAGER)\n * @public\n * @param {Address} account\n * @param {bigint} roles\n * @param {?ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(\n account: Address,\n roles: bigint,\n params?: ReadParams<typeof managedBudgetAbi, 'hasAnyRole'>,\n ) {\n return readManagedBudgetHasAnyRole(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 budget.hasAllRoles(0xfoo, ManagedBudgetRoles.ADMIN & ManagedBudgetRoles.MANAGER)\n *\n * @public\n * @param {Address} account\n * @param {bigint} roles\n * @param {?ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>} [params]\n * @returns {*}\n */\n public hasAllRoles(\n account: Address,\n roles: bigint,\n params?: ReadParams<typeof managedBudgetAbi, 'hasAllRoles'>,\n ) {\n return readManagedBudgetHasAllRoles(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 budget\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams<typeof managedBudgetAbi, 'isAuthorized'>} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(\n account: Address,\n params?: ReadParams<typeof managedBudgetAbi, 'isAuthorized'>,\n ) {\n return readManagedBudgetIsAuthorized(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 * Get the owner of the budget\n *\n * @public\n * @param {?ReadParams<typeof managedBudgetAbi, 'owner'>} [params]\n * @returns {Promise<Address>}\n */\n public owner(params?: ReadParams<typeof managedBudgetAbi, 'owner'>) {\n return readManagedBudgetOwner(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 total amount of assets allocated to the budget, including any that have been distributed\n * If a tokenId is provided, get the total amount of ERC1155 assets allocated to the budget, including any that have been distributed\n *\n * @public\n * @param {Address} asset - The address of the asset\n * @param {?(bigint | undefined)} [tokenId] - The ID of the token\n * @param {?ReadParams<typeof managedBudgetAbi, 'total'>} [params]\n * @returns {Promise<bigint>} - The total amount of assets\n */\n public total(\n asset: Address,\n tokenId?: bigint | undefined,\n params?: ReadParams<typeof managedBudgetAbi, 'total'>,\n ) {\n return readManagedBudgetTotal(this._config, {\n address: this.assertValidAddress(),\n args: tokenId ? [asset, tokenId] : [asset],\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 amount of assets available for distribution from the budget.\n * If a tokenId is provided, get the amount of ERC1155 assets available for distribution from the budget\n *\n * @public\n * @param {Address} asset\n * @param {?(bigint | undefined)} [tokenId]\n * @param {?ReadParams<typeof managedBudgetAbi, 'available'>} [params]\n * @returns {Promise<bigint>} - The amount of assets available\n */\n public available(\n asset: Address,\n tokenId?: bigint | undefined,\n params?: ReadParams<typeof managedBudgetAbi, 'available'>,\n ) {\n return readManagedBudgetAvailable(this._config, {\n address: this.assertValidAddress(),\n args: tokenId ? [asset, tokenId] : [asset],\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 amount of assets that have been distributed from the budget.\n * If a tokenId is provided, get the amount of ERC1155 assets that have been distributed from the budget\n *\n * @public\n * @param {Address} asset\n * @param {?(bigint | undefined)} [tokenId]\n * @param {?ReadParams<typeof managedBudgetAbi, 'distributed'>} [params]\n * @returns {Promise<bigint>} - The amount of assets distributed\n */\n public distributed(\n asset: Address,\n tokenId?: bigint | undefined,\n params?: ReadParams<typeof managedBudgetAbi, 'distributed'>,\n ) {\n return readManagedBudgetDistributed(this._config, {\n address: this.assertValidAddress(),\n args: tokenId ? [asset, tokenId] : [asset],\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 {?ManagedBudgetPayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ManagedBudgetPayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n if (!payload.owner || payload.owner === zeroAddress) {\n const owner = options.account\n ? options.account.address\n : options.config\n ? getAccount(options.config).address\n : this._account?.address;\n if (owner) {\n payload.owner = owner;\n } else {\n throw new DeployableUnknownOwnerProvidedError();\n }\n }\n return {\n abi: managedBudgetAbi,\n bytecode: bytecode as Hex,\n args: [prepareManagedBudgetPayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n"],"names":["ManagedBudgetRoles","isFungibleTransfer","transfer","isERC1155TransferPayload","prepareTransfer","prepareFungibleTransfer","prepareERC1155Transfer","UnknownTransferPayloadSupplied","_ManagedBudget","DeployableTarget","managedBudgetAbi","params","request","result","simulateManagedBudgetAllocate","writeManagedBudgetAllocate","simulateManagedBudgetClawback","writeManagedBudgetClawback","simulateManagedBudgetDisburse","writeManagedBudgetDisburse","transfers","simulateManagedBudgetDisburseBatch","writeManagedBudgetDisburseBatch","addresses","allowed","simulateManagedBudgetSetAuthorized","writeManagedBudgetSetAuthorized","roles","simulateManagedBudgetGrantRoles","writeManagedBudgetGrantRoles","simulateManagedBudgetRevokeRoles","writeManagedBudgetRevokeRoles","account","readManagedBudgetRolesOf","role","readManagedBudgetHasAnyRole","readManagedBudgetHasAllRoles","readManagedBudgetIsAuthorized","readManagedBudgetOwner","asset","tokenId","readManagedBudgetTotal","readManagedBudgetAvailable","readManagedBudgetDistributed","_payload","_options","payload","options","zeroAddress","owner","getAccount","_a","DeployableUnknownOwnerProvidedError","bytecode","prepareManagedBudgetPayload","RegistryType","ManagedBudget"],"mappings":";;;;;;4x1BAqEaA,IAAqB;AAAA,EAChC,SAAS;AAAA,EACT,OAAO;AACT;AAwBO,SAASC,EACdC,GACqC;AACrC,SAAQA,EAAoC,YAAY;AAC1D;AASO,SAASC,EACdD,GACoC;AACpC,SAAQA,EAAoC,YAAY;AAC1D;AAUO,SAASE,EACdF,GACA;AACI,MAAAD,EAAmBC,CAAQ;AAC7B,WAAOG,EAAwBH,CAAQ;AACzC,MAAWC,EAAyBD,CAAQ;AAC1C,WAAOI,EAAuBJ,CAAQ;AAC3B,QAAA,IAAIK,EAA+BL,CAAQ;AAC1D;AAWO,MAAMM,IAAN,MAAMA,UAAsBC,EAGjC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAWL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA8B/B,MAAa,SACXR,GACAS,GACA;AACA,WAAO,KAAK,YAAY,KAAK,YAAYT,GAAUS,CAAM,CAAC;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAaA,MAAa,YACXT,GACAS,GACA;AACA,UAAM,EAAE,SAAAC,GAAS,QAAAC,EAAO,IAAI,MAAMC;AAAAA,MAChC,KAAK;AAAA,MACL;AAA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GAAOC,CAAO,IAAI,CAACD,CAAK;AAAA;AAAA,MAEzC,GAAI5B;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUgB,gBACdiC,GACAC,GACyB;;AACzB,UAAM,CAACC,GAASC,CAAO,IAAI,KAAK;AAAA,MAC9BH;AAAA,MACAC;AAAA,IAAA;AAEF,QAAI,CAACC,EAAQ,SAASA,EAAQ,UAAUE,GAAa;AACnD,YAAMC,IAAQF,EAAQ,UAClBA,EAAQ,QAAQ,UAChBA,EAAQ,SACNG,EAAWH,EAAQ,MAAM,EAAE,WAC3BI,IAAA,KAAK,aAAL,gBAAAA,EAAe;AACrB,UAAIF;AACF,QAAAH,EAAQ,QAAQG;AAAA;AAEhB,cAAM,IAAIG,EAAoC;AAAA,IAElD;AACO,WAAA;AAAA,MACL,KAAK1C;AAAAA,MACL,UAAA2C;AAAA,MACA,MAAM,CAACC,EAA4BR,CAAO,CAAC;AAAA,MAC3C,GAAG,KAAK,wBAAwBC,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AACF;AArkByBvC,EAAA,OAAgB,8CASvCA,EAAuB,eAA6B+C,EAAa;AA5B5D,IAAMC,IAANhD;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("@wagmi/core"),i=require("viem"),o=require("viem/actions"),d=require("../errors.cjs"),c=require("../utils.cjs");class h{constructor(e,t){this._config=e,this._address=t}get address(){return this._address}at(e){return this._address=e,this}withConfig(e){return this._config=e,this}assertValidAddress(){const e=this.address;if(!e)throw new d.ContractAddressRequiredError;return e}async getLogs(e){return o.getLogs(this._config.getClient({chainId:e==null?void 0:e.chainId}),{...e,...e!=null&&e.eventName?{event:i.getAbiItem({abi:this.abi,name:e.eventName})}:{},...e!=null&&e.eventNames?{events:e.eventNames.map(t=>i.getAbiItem({abi:this.abi,name:t}))}:{},address:this.assertValidAddress()})}async subscribe(e,t){return r.watchContractEvent(this._config,{...t,eventName:t==null?void 0:t.eventName,abi:this.abi,address:this.assertValidAddress(),onLogs:s=>{for(let n of s)e(n)}})}async awaitResult(e,t){return c.awaitResult(this._config,e,t)}}exports.Contract=h;
|
|
2
|
+
//# sourceMappingURL=Contract.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contract.cjs","sources":["../../src/Deployable/Contract.ts"],"sourcesContent":["import { type Config, watchContractEvent } from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport {\n type Abi,\n type Address,\n type ContractEventName,\n type GetLogsReturnType,\n type WaitForTransactionReceiptParameters,\n type WatchContractEventOnLogsParameter,\n getAbiItem,\n} from 'viem';\nimport { getLogs } from 'viem/actions';\nimport { ContractAddressRequiredError } from '../errors';\nimport {\n type GetLogsParams,\n type HashAndSimulatedResult,\n type WatchParams,\n awaitResult,\n} from '../utils';\n\n/**\n * A basic Contract class to encapsulate configuration and a potential address\n *\n * @export\n * @class Contract\n * @typedef {Contract}\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=any]\n */\nexport class Contract<ContractAbi extends Abi> {\n //@ts-expect-error this should always be set by implementing contract\n public readonly abi: ContractAbi;\n /**\n * @see [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @protected\n * @type {WagmiConfig}\n */\n protected _config: Config;\n /**\n * The internally managed address for this contract\n *\n * @protected\n * @type {(Address | undefined)}\n */\n protected _address: Address | undefined;\n\n /**\n * Creates an instance of Contract.\n *\n * @constructor\n * @param {Config} config\n * @param {(Address | undefined)} address\n */\n constructor(config: Config, address: Address | undefined) {\n this._config = config;\n this._address = address;\n }\n\n /**\n * A getter returning this contract's deployed address, if it exists.\n *\n * @public\n * @readonly\n * @type {*}\n */\n public get address() {\n return this._address;\n }\n\n /**\n * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.\n *\n * @public\n * @param {Address} address\n * @returns {this}\n */\n public at(address: Address) {\n this._address = address;\n return this;\n }\n\n /**\n * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.\n *\n * @public\n * @param {Config} config\n * @returns {this}\n */\n public withConfig(config: Config) {\n this._config = config;\n return this;\n }\n\n /**\n * Utility function to validate the existence of an address on this Contract.\n *\n * @public\n * @returns {Address}\n * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance\n */\n public assertValidAddress() {\n const address = this.address;\n if (!address) throw new ContractAddressRequiredError();\n return address;\n }\n\n /**\n * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].\n * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.\n * @example\n * ```ts\n * const logs = contract.getLogs({ eventName: 'EventName' })\n * const logs = contract.getLogs({ eventNames: ['EventName'] })\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @template {ExtractAbiEvent<\n * ContractAbi,\n * event\n * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]\n * @param {?Omit<\n * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n * 'event' | 'events'\n * > & {\n * eventName?: event;\n * eventNames?: event[];\n * }} [params]\n * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}\n */\n public async getLogs<\n event extends ContractEventName<ContractAbi>,\n const abiEvent extends ExtractAbiEvent<\n ContractAbi,\n event\n > = ExtractAbiEvent<ContractAbi, event>,\n >(\n params?: Omit<\n GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n 'event' | 'events'\n > & {\n eventName?: event;\n eventNames?: event[];\n },\n ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {\n return getLogs(this._config.getClient({ chainId: params?.chainId }), {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag\n ...(params as any),\n ...(params?.eventName\n ? {\n event: getAbiItem({\n abi: this.abi,\n name: params.eventName,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n }\n : {}),\n ...(params?.eventNames\n ? {\n events: params.eventNames.map((name) =>\n getAbiItem({\n abi: this.abi,\n name,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n ),\n }\n : {}),\n address: this.assertValidAddress(),\n });\n }\n\n /**\n * A typed wrapper for `wagmi.watchContractEvent`\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @param {(\n * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n * ) => unknown} cb\n * @param {?WatchParams<ContractAbi, event> & {\n * eventName?: event;\n * }} [params]\n * @returns {unknown, params?: any) => unknown}\n */\n public async subscribe<event extends ContractEventName<ContractAbi>>(\n cb: (\n log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n ) => unknown,\n params?: WatchParams<ContractAbi, event> & {\n eventName?: event;\n },\n ) {\n return watchContractEvent<\n typeof this._config,\n (typeof this._config)['chains'][number]['id'],\n ContractAbi,\n event\n >(this._config, {\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 eventName: params?.eventName,\n abi: this.abi,\n address: this.assertValidAddress(),\n onLogs: (logs) => {\n for (let l of logs) {\n cb(l);\n }\n },\n });\n }\n\n /**\n * @see {@link awaitResult}\n * @protected\n * @async\n * @template [Result=unknown]\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {unknown}\n */\n protected async awaitResult<Result = unknown>(\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n return awaitResult(this._config, hashPromise, waitParams);\n }\n}\n"],"names":["Contract","config","address","ContractAddressRequiredError","params","getLogs","getAbiItem","name","cb","watchContractEvent","logs","l","hashPromise","waitParams","awaitResult"],"mappings":"gNA6BO,MAAMA,CAAkC,CAwB7C,YAAYC,EAAgBC,EAA8B,CACxD,KAAK,QAAUD,EACf,KAAK,SAAWC,CAClB,CASA,IAAW,SAAU,CACnB,OAAO,KAAK,QACd,CASO,GAAGA,EAAkB,CAC1B,YAAK,SAAWA,EACT,IACT,CASO,WAAWD,EAAgB,CAChC,YAAK,QAAUA,EACR,IACT,CASO,oBAAqB,CAC1B,MAAMC,EAAU,KAAK,QACrB,GAAI,CAACA,EAAS,MAAM,IAAIC,EAA6B,6BAC9C,OAAAD,CACT,CA0BA,MAAa,QAOXE,EAOkD,CAC3C,OAAAC,EAAA,QAAQ,KAAK,QAAQ,UAAU,CAAE,QAASD,GAAA,YAAAA,EAAQ,OAAQ,CAAC,EAAG,CAEnE,GAAIA,EACJ,GAAIA,GAAA,MAAAA,EAAQ,UACR,CACE,MAAOE,EAAAA,WAAW,CAChB,IAAK,KAAK,IACV,KAAMF,EAAO,SAAA,CAEP,CAAA,EAEV,CAAC,EACL,GAAIA,GAAA,MAAAA,EAAQ,WACR,CACE,OAAQA,EAAO,WAAW,IAAKG,GAC7BD,EAAAA,WAAW,CACT,IAAK,KAAK,IACV,KAAAC,CAAA,CAEM,CACV,CAAA,EAEF,CAAC,EACL,QAAS,KAAK,mBAAmB,CAAA,CAClC,CACH,CAgBA,MAAa,UACXC,EAGAJ,EAGA,CACO,OAAAK,EAAA,mBAKL,KAAK,QAAS,CAEd,GAAIL,EACJ,UAAWA,GAAA,YAAAA,EAAQ,UACnB,IAAK,KAAK,IACV,QAAS,KAAK,mBAAmB,EACjC,OAASM,GAAS,CAChB,QAASC,KAAKD,EACZF,EAAGG,CAAC,CAER,CAAA,CACD,CACH,CAWA,MAAgB,YACdC,EACAC,EACA,CACA,OAAOC,EAAY,YAAA,KAAK,QAASF,EAAaC,CAAU,CAC1D,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Contract.js","sources":["../../src/Deployable/Contract.ts"],"sourcesContent":["import { type Config, watchContractEvent } from '@wagmi/core';\nimport type { ExtractAbiEvent } from 'abitype';\nimport {\n type Abi,\n type Address,\n type ContractEventName,\n type GetLogsReturnType,\n type WaitForTransactionReceiptParameters,\n type WatchContractEventOnLogsParameter,\n getAbiItem,\n} from 'viem';\nimport { getLogs } from 'viem/actions';\nimport { ContractAddressRequiredError } from '../errors';\nimport {\n type GetLogsParams,\n type HashAndSimulatedResult,\n type WatchParams,\n awaitResult,\n} from '../utils';\n\n/**\n * A basic Contract class to encapsulate configuration and a potential address\n *\n * @export\n * @class Contract\n * @typedef {Contract}\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=any]\n */\nexport class Contract<ContractAbi extends Abi> {\n //@ts-expect-error this should always be set by implementing contract\n public readonly abi: ContractAbi;\n /**\n * @see [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n * @protected\n * @type {WagmiConfig}\n */\n protected _config: Config;\n /**\n * The internally managed address for this contract\n *\n * @protected\n * @type {(Address | undefined)}\n */\n protected _address: Address | undefined;\n\n /**\n * Creates an instance of Contract.\n *\n * @constructor\n * @param {Config} config\n * @param {(Address | undefined)} address\n */\n constructor(config: Config, address: Address | undefined) {\n this._config = config;\n this._address = address;\n }\n\n /**\n * A getter returning this contract's deployed address, if it exists.\n *\n * @public\n * @readonly\n * @type {*}\n */\n public get address() {\n return this._address;\n }\n\n /**\n * Will set this contract's address and return the instance for chaining. Does not verify that provided address is valid.\n *\n * @public\n * @param {Address} address\n * @returns {this}\n */\n public at(address: Address) {\n this._address = address;\n return this;\n }\n\n /**\n * Will set this contract's internal [Wagmi Configuration](https://en.wikipedia.org/wiki/Factorial) and return the instance for chaining.\n *\n * @public\n * @param {Config} config\n * @returns {this}\n */\n public withConfig(config: Config) {\n this._config = config;\n return this;\n }\n\n /**\n * Utility function to validate the existence of an address on this Contract.\n *\n * @public\n * @returns {Address}\n * @throws {@link ContractAddressRequiredError} if no address exists on this Contract instance\n */\n public assertValidAddress() {\n const address = this.address;\n if (!address) throw new ContractAddressRequiredError();\n return address;\n }\n\n /**\n * A typed wrapper for (viem.getLogs)[https://viem.sh/docs/actions/public/getLogs#getlogs].\n * Accepts `eventName` and `eventNames` as optional parameters to narrow the returned log types.\n * @example\n * ```ts\n * const logs = contract.getLogs({ eventName: 'EventName' })\n * const logs = contract.getLogs({ eventNames: ['EventName'] })\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @template {ExtractAbiEvent<\n * ContractAbi,\n * event\n * >} [abiEvent=ExtractAbiEvent<ContractAbi, event>]\n * @param {?Omit<\n * GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n * 'event' | 'events'\n * > & {\n * eventName?: event;\n * eventNames?: event[];\n * }} [params]\n * @returns {Promise<GetLogsReturnType<abiEvent, abiEvent[]>>}\n */\n public async getLogs<\n event extends ContractEventName<ContractAbi>,\n const abiEvent extends ExtractAbiEvent<\n ContractAbi,\n event\n > = ExtractAbiEvent<ContractAbi, event>,\n >(\n params?: Omit<\n GetLogsParams<ContractAbi, event, abiEvent, abiEvent[]>,\n 'event' | 'events'\n > & {\n eventName?: event;\n eventNames?: event[];\n },\n ): Promise<GetLogsReturnType<abiEvent, abiEvent[]>> {\n return getLogs(this._config.getClient({ chainId: params?.chainId }), {\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wag\n ...(params as any),\n ...(params?.eventName\n ? {\n event: getAbiItem({\n abi: this.abi,\n name: params.eventName,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n }\n : {}),\n ...(params?.eventNames\n ? {\n events: params.eventNames.map((name) =>\n getAbiItem({\n abi: this.abi,\n name,\n // biome-ignore lint/suspicious/noExplicitAny: awkward abi intersection issue\n } as any),\n ),\n }\n : {}),\n address: this.assertValidAddress(),\n });\n }\n\n /**\n * A typed wrapper for `wagmi.watchContractEvent`\n *\n * @public\n * @async\n * @template {ContractEvent} event\n * @param {(\n * log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n * ) => unknown} cb\n * @param {?WatchParams<ContractAbi, event> & {\n * eventName?: event;\n * }} [params]\n * @returns {unknown, params?: any) => unknown}\n */\n public async subscribe<event extends ContractEventName<ContractAbi>>(\n cb: (\n log: WatchContractEventOnLogsParameter<ContractAbi, event, true>[number],\n ) => unknown,\n params?: WatchParams<ContractAbi, event> & {\n eventName?: event;\n },\n ) {\n return watchContractEvent<\n typeof this._config,\n (typeof this._config)['chains'][number]['id'],\n ContractAbi,\n event\n >(this._config, {\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 eventName: params?.eventName,\n abi: this.abi,\n address: this.assertValidAddress(),\n onLogs: (logs) => {\n for (let l of logs) {\n cb(l);\n }\n },\n });\n }\n\n /**\n * @see {@link awaitResult}\n * @protected\n * @async\n * @template [Result=unknown]\n * @param {Promise<HashAndSimulatedResult<Result>>} hashPromise\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams]\n * @returns {unknown}\n */\n protected async awaitResult<Result = unknown>(\n hashPromise: Promise<HashAndSimulatedResult<Result>>,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n return awaitResult(this._config, hashPromise, waitParams);\n }\n}\n"],"names":["Contract","config","address","ContractAddressRequiredError","params","getLogs","getAbiItem","name","cb","watchContractEvent","logs","l","hashPromise","waitParams","awaitResult"],"mappings":";;;;;AA6BO,MAAMA,EAAkC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAwB7C,YAAYC,GAAgBC,GAA8B;AACxD,SAAK,UAAUD,GACf,KAAK,WAAWC;AAAA,EAClB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAW,UAAU;AACnB,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,GAAGA,GAAkB;AAC1B,gBAAK,WAAWA,GACT;AAAA,EACT;AAAA;AAAA;AAAA;AA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AAK,mBAAmB;AAAA,MACjC,QAAQ,CAACM,MAAS;AAChB,iBAASC,KAAKD;AACZ,UAAAF,EAAGG,CAAC;AAAA,MAER;AAAA,IAAA,CACD;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAgB,YACdC,GACAC,GACA;AACA,WAAOC,EAAY,KAAK,SAASF,GAAaC,CAAU;AAAA,EAC1D;AACF;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("@wagmi/core"),a=require("../errors.cjs"),n=require("../utils.cjs"),c=require("./Contract.cjs");class l extends c.Contract{constructor({account:t,config:e},o){typeof o=="string"?super(e,o):(super(e,void 0),this._payload=o),t&&(this._account=t)}get payload(){return this._payload}withPayload(t){return this._payload=t,this}async deploy(t,e,o){const r=(e==null?void 0:e.config)||this._config,i=await n.getDeployedContractAddress(r,this.deployRaw(t,e),o);return this._address=i,this}async deployRaw(t,e){if(this.address)throw new a.DeployableAlreadyDeployedError(this.address);const[o,r]=this.validateDeploymentConfig(t,e);return await s.deployContract(r.config,{...this.buildParameters(o),...this.optionallyAttachAccount(r.account)})}optionallyAttachAccount(t){return t?{account:t}:this._account?{account:this._account}:{}}buildParameters(t,e){throw new a.DeployableBuildParametersUnspecifiedError}validateDeploymentConfig(t,e){const o=e||{config:this._config,account:this._account};if(!o)throw new a.DeployableWagmiConfigurationRequiredError;return[t||this._payload,o]}}exports.Deployable=l;
|
|
2
|
+
//# sourceMappingURL=Deployable.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deployable.cjs","sources":["../../src/Deployable/Deployable.ts"],"sourcesContent":["import { type Config, deployContract } from '@wagmi/core';\nimport type {\n Abi,\n Account,\n Address,\n ContractEventName,\n Hash,\n Hex,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableBuildParametersUnspecifiedError,\n DeployableMissingPayloadError,\n DeployableWagmiConfigurationRequiredError,\n} from '../errors';\nimport { getDeployedContractAddress } from '../utils';\nimport { Contract } from './Contract';\n\n/**\n * A base class representing a deployable contract, contains base implementations for deployment and initialization payload construction.\n *\n * @export\n * @typedef {GenericDeployableParams}\n */\nexport type GenericDeployableParams = Omit<\n Parameters<typeof deployContract>[1],\n 'args' | 'account'\n> & {\n args: [Hex, ...Array<Hex>];\n account?: Account;\n};\n\n/**\n * A generic type that encapsulates either an initialization payload for a contract, or a valid address for a previously deployed contract.\n *\n * @export\n * @typedef {DeployablePayloadOrAddress}\n * @template [Payload=unknown]\n */\nexport type DeployablePayloadOrAddress<Payload = unknown> = Payload | Address;\n\n/**\n * Instantion options for the base deployable.\n *\n * @export\n * @interface DeployableOptions\n * @typedef {DeployableOptions}\n */\nexport interface DeployableOptions {\n /**\n * [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n *\n * @see {@link Config}\n * @type {Config}\n */\n config: Config;\n /**\n * [Viem Local Account](https://viem.sh/docs/accounts/local), required if in a Node environment\n *\n * @see {@link Account}\n * @type {?Account}\n */\n account?: Account;\n}\n\n/**\n * A generic deployable contract that encapsulates common operations related to contract deployment\n *\n * @export\n * @class Deployable\n * @typedef {Deployable}\n * @template [Payload=unknown]\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=ContractEventName<ContractAbi>]\n * @extends {Contract<ContractAbi, ContractEvent>}\n */\nexport class Deployable<\n Payload,\n ContractAbi extends Abi,\n> extends Contract<ContractAbi> {\n /**\n * The deployable payload used either for contract construction or initialization\n *\n * @protected\n * @type {(Payload | undefined)}\n */\n protected _payload: Payload | undefined;\n /**\n * If it exists, [Viem Local Account](https://viem.sh/docs/accounts/local), if in a Node environment\n *\n * @protected\n * @type {?Account}\n */\n protected _account?: Account;\n\n /**\n * Creates an instance of Deployable.\n *\n * @constructor\n * @param {DeployableOptions} param0\n * @param {?Account} [param0.account]\n * @param {Config} param0.config\n * @param {DeployablePayloadOrAddress<Payload>} payload\n */\n constructor(\n { account, config }: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n ) {\n if (typeof payload === 'string') {\n super(config, payload as Address);\n } else {\n super(config, undefined);\n this._payload = payload as Payload;\n }\n if (account) this._account = account;\n }\n\n /**\n * Returns the attached deployable payload, if it exists\n *\n * @readonly\n * @type {Payload}\n */\n get payload() {\n return this._payload;\n }\n\n /**\n * Attaches a new payload for use with this deployable's initialization\n *\n * @public\n * @param {Payload} payload\n * @returns {this}\n */\n public withPayload(payload: Payload) {\n this._payload = payload;\n return this;\n }\n\n /**\n * High level deployment function to deploy and await the contract address.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)\n * @returns {unknown}\n */\n public async deploy(\n _payload?: Payload,\n _options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n const config = _options?.config || this._config;\n const address = await getDeployedContractAddress(\n config,\n this.deployRaw(_payload, _options),\n waitParams,\n );\n this._address = address;\n return this;\n }\n\n /**\n * The lower level contract deployment function that does not await for the transaction receipt.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n * @throws {@link DeployableAlreadyDeployedError}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n public async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return await deployContract(options.config, {\n ...this.buildParameters(payload),\n ...this.optionallyAttachAccount(options.account),\n });\n }\n\n /**\n * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.\n *\n * @protected\n * @param {?Account} [account]\n * @returns {({ account: Account; } | { account?: undefined; })}\n */\n protected optionallyAttachAccount(account?: Account) {\n if (account) return { account };\n return this._account ? { account: this._account } : {};\n }\n\n /**\n * Base parameter constructor, should return a partial `viem.deployContract` parameters shape including abi, bytecode, and arguments, if any.\n * Expected to be overridden by protocol contracts.\n *\n * @public\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n throw new DeployableBuildParametersUnspecifiedError();\n }\n\n /**\n * Internal method used to ensure that a Wagmi configuration and payload are always present when deploying.\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const options = _options || {\n config: this._config,\n account: this._account,\n };\n if (!options) throw new DeployableWagmiConfigurationRequiredError();\n const payload = _payload || this._payload;\n return [payload, options] as [P, DeployableOptions];\n }\n}\n"],"names":["Deployable","Contract","account","config","payload","_payload","_options","waitParams","address","getDeployedContractAddress","DeployableAlreadyDeployedError","options","deployContract","DeployableBuildParametersUnspecifiedError","DeployableWagmiConfigurationRequiredError"],"mappings":"gMA6EO,MAAMA,UAGHC,EAAAA,QAAsB,CAyB9B,YACE,CAAE,QAAAC,EAAS,OAAAC,CAAA,EACXC,EACA,CACI,OAAOA,GAAY,SACrB,MAAMD,EAAQC,CAAkB,GAEhC,MAAMD,EAAQ,MAAS,EACvB,KAAK,SAAWC,GAEdF,IAAS,KAAK,SAAWA,EAC/B,CAQA,IAAI,SAAU,CACZ,OAAO,KAAK,QACd,CASO,YAAYE,EAAkB,CACnC,YAAK,SAAWA,EACT,IACT,CAYA,MAAa,OACXC,EACAC,EACAC,EACA,CACM,MAAAJ,GAASG,GAAA,YAAAA,EAAU,SAAU,KAAK,QAClCE,EAAU,MAAMC,EAAA,2BACpBN,EACA,KAAK,UAAUE,EAAUC,CAAQ,EACjCC,CAAA,EAEF,YAAK,SAAWC,EACT,IACT,CAcA,MAAa,UACXH,EACAC,EACe,CACf,GAAI,KAAK,QAAe,MAAA,IAAII,EAA+B,+BAAA,KAAK,OAAO,EACvE,KAAM,CAACN,EAASO,CAAO,EAAI,KAAK,yBAC9BN,EACAC,CAAA,EAEK,OAAA,MAAMM,EAAAA,eAAeD,EAAQ,OAAQ,CAC1C,GAAG,KAAK,gBAAgBP,CAAO,EAC/B,GAAG,KAAK,wBAAwBO,EAAQ,OAAO,CAAA,CAChD,CACH,CASU,wBAAwBT,EAAmB,CAC/C,OAAAA,EAAgB,CAAE,QAAAA,CAAQ,EACvB,KAAK,SAAW,CAAE,QAAS,KAAK,UAAa,EACtD,CAWO,gBACLG,EACAC,EACyB,CACzB,MAAM,IAAIO,EAA0C,yCACtD,CAaU,yBACRR,EACAC,EACA,CACA,MAAMK,EAAUL,GAAY,CAC1B,OAAQ,KAAK,QACb,QAAS,KAAK,QAAA,EAEhB,GAAI,CAACK,EAAS,MAAM,IAAIG,EAA0C,0CAE3D,MAAA,CADST,GAAY,KAAK,SAChBM,CAAO,CAC1B,CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Deployable.js","sources":["../../src/Deployable/Deployable.ts"],"sourcesContent":["import { type Config, deployContract } from '@wagmi/core';\nimport type {\n Abi,\n Account,\n Address,\n ContractEventName,\n Hash,\n Hex,\n WaitForTransactionReceiptParameters,\n} from 'viem';\nimport {\n DeployableAlreadyDeployedError,\n DeployableBuildParametersUnspecifiedError,\n DeployableMissingPayloadError,\n DeployableWagmiConfigurationRequiredError,\n} from '../errors';\nimport { getDeployedContractAddress } from '../utils';\nimport { Contract } from './Contract';\n\n/**\n * A base class representing a deployable contract, contains base implementations for deployment and initialization payload construction.\n *\n * @export\n * @typedef {GenericDeployableParams}\n */\nexport type GenericDeployableParams = Omit<\n Parameters<typeof deployContract>[1],\n 'args' | 'account'\n> & {\n args: [Hex, ...Array<Hex>];\n account?: Account;\n};\n\n/**\n * A generic type that encapsulates either an initialization payload for a contract, or a valid address for a previously deployed contract.\n *\n * @export\n * @typedef {DeployablePayloadOrAddress}\n * @template [Payload=unknown]\n */\nexport type DeployablePayloadOrAddress<Payload = unknown> = Payload | Address;\n\n/**\n * Instantion options for the base deployable.\n *\n * @export\n * @interface DeployableOptions\n * @typedef {DeployableOptions}\n */\nexport interface DeployableOptions {\n /**\n * [Wagmi Configuration](https://wagmi.sh/core/api/createConfig)\n *\n * @see {@link Config}\n * @type {Config}\n */\n config: Config;\n /**\n * [Viem Local Account](https://viem.sh/docs/accounts/local), required if in a Node environment\n *\n * @see {@link Account}\n * @type {?Account}\n */\n account?: Account;\n}\n\n/**\n * A generic deployable contract that encapsulates common operations related to contract deployment\n *\n * @export\n * @class Deployable\n * @typedef {Deployable}\n * @template [Payload=unknown]\n * @template {Abi} [ContractAbi=[]]\n * @template {ContractEventName<ContractAbi>} [ContractEvent=ContractEventName<ContractAbi>]\n * @extends {Contract<ContractAbi, ContractEvent>}\n */\nexport class Deployable<\n Payload,\n ContractAbi extends Abi,\n> extends Contract<ContractAbi> {\n /**\n * The deployable payload used either for contract construction or initialization\n *\n * @protected\n * @type {(Payload | undefined)}\n */\n protected _payload: Payload | undefined;\n /**\n * If it exists, [Viem Local Account](https://viem.sh/docs/accounts/local), if in a Node environment\n *\n * @protected\n * @type {?Account}\n */\n protected _account?: Account;\n\n /**\n * Creates an instance of Deployable.\n *\n * @constructor\n * @param {DeployableOptions} param0\n * @param {?Account} [param0.account]\n * @param {Config} param0.config\n * @param {DeployablePayloadOrAddress<Payload>} payload\n */\n constructor(\n { account, config }: DeployableOptions,\n payload?: DeployablePayloadOrAddress<Payload>,\n ) {\n if (typeof payload === 'string') {\n super(config, payload as Address);\n } else {\n super(config, undefined);\n this._payload = payload as Payload;\n }\n if (account) this._account = account;\n }\n\n /**\n * Returns the attached deployable payload, if it exists\n *\n * @readonly\n * @type {Payload}\n */\n get payload() {\n return this._payload;\n }\n\n /**\n * Attaches a new payload for use with this deployable's initialization\n *\n * @public\n * @param {Payload} payload\n * @returns {this}\n */\n public withPayload(payload: Payload) {\n this._payload = payload;\n return this;\n }\n\n /**\n * High level deployment function to deploy and await the contract address.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @param {?Omit<WaitForTransactionReceiptParameters, 'hash'>} [waitParams] - See [viem.WaitForTransactionReceipt](https://v1.viem.sh/docs/actions/public/waitForTransactionReceipt.html#waitfortransactionreceipt)\n * @returns {unknown}\n */\n public async deploy(\n _payload?: Payload,\n _options?: DeployableOptions,\n waitParams?: Omit<WaitForTransactionReceiptParameters, 'hash'>,\n ) {\n const config = _options?.config || this._config;\n const address = await getDeployedContractAddress(\n config,\n this.deployRaw(_payload, _options),\n waitParams,\n );\n this._address = address;\n return this;\n }\n\n /**\n * The lower level contract deployment function that does not await for the transaction receipt.\n *\n * @public\n * @async\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {Promise<Hash>}\n * @throws {@link DeployableAlreadyDeployedError}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n public async deployRaw(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): Promise<Hash> {\n if (this.address) throw new DeployableAlreadyDeployedError(this.address);\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return await deployContract(options.config, {\n ...this.buildParameters(payload),\n ...this.optionallyAttachAccount(options.account),\n });\n }\n\n /**\n * Internal function to attach the connected account to write methods to avoid manually passing in an account each call.\n *\n * @protected\n * @param {?Account} [account]\n * @returns {({ account: Account; } | { account?: undefined; })}\n */\n protected optionallyAttachAccount(account?: Account) {\n if (account) return { account };\n return this._account ? { account: this._account } : {};\n }\n\n /**\n * Base parameter constructor, should return a partial `viem.deployContract` parameters shape including abi, bytecode, and arguments, if any.\n * Expected to be overridden by protocol contracts.\n *\n * @public\n * @param {?Payload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public buildParameters(\n _payload?: Payload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n throw new DeployableBuildParametersUnspecifiedError();\n }\n\n /**\n * Internal method used to ensure that a Wagmi configuration and payload are always present when deploying.\n *\n * @protected\n * @template [P=Payload]\n * @param {?P} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {[P, DeployableOptions]}\n * @throws {@link DeployableWagmiConfigurationRequiredError}\n * @throws {@link DeployableMissingPayloadError}\n */\n protected validateDeploymentConfig<P = Payload>(\n _payload?: P,\n _options?: DeployableOptions,\n ) {\n const options = _options || {\n config: this._config,\n account: this._account,\n };\n if (!options) throw new DeployableWagmiConfigurationRequiredError();\n const payload = _payload || this._payload;\n return [payload, options] as [P, DeployableOptions];\n }\n}\n"],"names":["Deployable","Contract","account","config","payload","_payload","_options","waitParams","address","getDeployedContractAddress","DeployableAlreadyDeployedError","options","deployContract","DeployableBuildParametersUnspecifiedError","DeployableWagmiConfigurationRequiredError"],"mappings":";;;;AA6EO,MAAMA,UAGHC,EAAsB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAyB9B,YACE,EAAE,SAAAC,GAAS,QAAAC,EAAA,GACXC,GACA;AACI,IAAA,OAAOA,KAAY,WACrB,MAAMD,GAAQC,CAAkB,KAEhC,MAAMD,GAAQ,MAAS,GACvB,KAAK,WAAWC,IAEdF,MAAS,KAAK,WAAWA;AAAA,EAC/B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQA,IAAI,UAAU;AACZ,WAAO,KAAK;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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ACK;AAAS,YAAM,IAAIG,EAA0C;AAE3D,WAAA,CADST,KAAY,KAAK,UAChBM,CAAO;AAAA,EAC1B;AACF;"}
|
|
@@ -1 +1,2 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../generated-Cd-Fe7W7.cjs"),d=require("@wagmi/core"),l=require("viem"),n=require("../errors.cjs"),y=require("../utils.cjs"),u=require("./Deployable.cjs"),s=class s extends u.Deployable{constructor(t,e,r){super(t,e),this.isBase=!0,r!==void 0&&(this.isBase=r)}get base(){return this.constructor.base}get registryType(){return this.constructor.registryType}async deploy(t,e,r){return await super.deploy(t,e,r),this.assertValidAddress(),this}async deployRaw(t,e){if(this.address)throw new n.DeployableAlreadyDeployedError(this.address);const r=t||this._payload,o=(e==null?void 0:e.config)||this._config,{args:h,...c}=this.buildParameters(r);return await d.deployContract(o,{...c,...this.optionallyAttachAccount(e==null?void 0:e.account),args:[]})}async supportsInterface(t,e){return i.Xn(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...e,args:[t]})}async getComponentInterface(t){return i.Kn(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...t,args:[]})}validateDeploymentConfig(t,e){const r=t||this._payload;if(!r)throw new n.DeployableMissingPayloadError;return super.validateDeploymentConfig(r,e)}};s.base=l.zeroAddress,s.registryType=y.RegistryType.ACTION;let a=s;exports.DeployableTarget=a;
|
|
2
|
+
//# sourceMappingURL=DeployableTarget.cjs.map
|
|
@@ -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,EAC1C;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAW,OAAgB;AACzB,WAAQ,KAAK,YAAwC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,IAAW,eAA6B;AACtC,WAAQ,KAAK,YAAwC;AAAA,EACvD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAsB,OACpBD,GACAD,GACAG,GACA;AACA,iBAAM,MAAM,OAAOF,GAASD,GAASG,CAAU,GAC/C,KAAK,mBAAmB,GACjB;AAAA,EACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAsB,UACpBC,GACAC,GACe;AACf,QAAI,KAAK;AAAe,YAAA,IAAIC,EAA+B,KAAK,OAAO;AACjE,UAAAL,IAAUG,KAAY,KAAK,UAC3BG,KAASF,KAAA,gBAAAA,EAAU,WAAU,KAAK,SAClC,EAAE,MAAAG,GAAM,GAAGC,MAAe,KAAK,gBAAgBR,CAAO;AACrD,WAAA,MAAMS,EAAeH,GAAQ;AAAA,MAClC,GAAGE;AAAA,MACH,GAAG,KAAK,wBAAwBJ,KAAA,gBAAAA,EAAU,OAAO;AAAA;AAAA,MAEjD,MAAM,CAAC;AAAA,IAAA,CACR;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,kBACXM,GACAC,GACA;AACO,WAAAC,EAAgC,KAAK,SAAS;AAAA,MACnD,SAAS,KAAK,mBAAmB;AAAA,MACjC,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAID;AAAA,MACJ,MAAM,CAACD,CAAW;AAAA,IAAA,CACnB;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,sBACXC,GACA;AACO,WAAAE,EAAoC,KAAK,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,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,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,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA2B/B,MAAa,MACXC,GACA;AACO,WAAAC,EAA4B,KAAK,SAAS;AAAA,MAC/C,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,OACXA,GACA;AACO,WAAAE,EAA6B,KAAK,SAAS;AAAA,MAChD,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,OACXA,GACA;AACO,WAAAG,EAA6B,KAAK,SAAS;AAAA,MAChD,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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J,CAAO,GACtD,QAAAC;EACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,YACXF,GACAT,GACA;AACO,WAAAe,EAAkC,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACF,EAAoBJ,CAAO,CAAC;AAAA;AAAA,MAEnC,GAAIT;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUgB,gBACdgB,GACAC,GACyB;AACzB,UAAM,CAACR,GAASS,CAAO,IAAI,KAAK;AAAA,MAC9BF;AAAA,MACAC;AAAA,IAAA;AAEK,WAAA;AAAA,MACL,KAAKlB;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","_pay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O,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,MAA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,GACA;AACO,WAAAqB,EAA6B,KAAK,SAAS;AAAA,MAChD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACJ,EAAoBJ,CAAO,CAAC;AAAA;AAAA,MAEnC,GAAIb;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYA,MAAa,cACXA,GACA;AACO,WAAAsB,EAA+B,KAAK,SAAS;AAAA,MAClD,SAAS,KAAK,mBAAmB;AAAA;AAAA,MAEjC,GAAItB;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUgB,gBACduB,GACAC,GACyB;AACzB,UAAM,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
|