@boostxyz/sdk 0.0.0-alpha.9 → 1.1.0-alpha.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.cjs.map +1 -1
- package/dist/Actions/Action.js +2 -2
- package/dist/Actions/ContractAction.d.ts +11 -11
- package/dist/Actions/ContractAction.d.ts.map +1 -1
- package/dist/Actions/ERC721MintAction.d.ts +14 -14
- package/dist/Actions/ERC721MintAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +174 -41
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +557 -129
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.cjs.map +1 -1
- package/dist/AllowLists/AllowList.d.ts +6 -4
- package/dist/AllowLists/AllowList.d.ts.map +1 -1
- package/dist/AllowLists/AllowList.js +45 -23
- package/dist/AllowLists/AllowList.js.map +1 -1
- package/dist/AllowLists/OpenAllowList.d.ts +423 -0
- package/dist/AllowLists/OpenAllowList.d.ts.map +1 -0
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +92 -37
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +60 -75
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs.map +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts +203 -11
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +11 -112
- package/dist/AllowLists/SimpleDenyList.js.map +1 -1
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/Boost.cjs +1 -1
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.d.ts +20 -21
- package/dist/Boost.d.ts.map +1 -1
- package/dist/Boost.js +43 -57
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore-Btl5BdAs.cjs +3 -0
- package/dist/BoostCore-Btl5BdAs.cjs.map +1 -0
- package/dist/BoostCore-CD56zbYX.js +2641 -0
- package/dist/BoostCore-CD56zbYX.js.map +1 -0
- package/dist/BoostCore.cjs +1 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +749 -78
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +29 -1150
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts +80 -25
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +164 -82
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.cjs.map +1 -1
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/Budget.js.map +1 -1
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts +103 -221
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +81 -298
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts +223 -89
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/Contract.cjs +1 -1
- package/dist/Deployable/Contract.cjs.map +1 -1
- package/dist/Deployable/Contract.d.ts +4 -5
- package/dist/Deployable/Contract.d.ts.map +1 -1
- package/dist/Deployable/Contract.js +5 -7
- package/dist/Deployable/Contract.js.map +1 -1
- package/dist/Deployable/Deployable.cjs.map +1 -1
- package/dist/Deployable/Deployable.d.ts +1 -1
- package/dist/Deployable/Deployable.d.ts.map +1 -1
- package/dist/Deployable/Deployable.js +3 -5
- package/dist/Deployable/Deployable.js.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts +13 -13
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +28 -25
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +2 -0
- package/dist/Deployable/DeployableTargetWithRBAC.cjs.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts +248 -0
- package/dist/Deployable/DeployableTargetWithRBAC.d.ts.map +1 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js +320 -0
- package/dist/Deployable/DeployableTargetWithRBAC.js.map +1 -0
- package/dist/Incentive-CcnOIc8L.cjs +2 -0
- package/dist/Incentive-CcnOIc8L.cjs.map +1 -0
- package/dist/Incentive-rM5nKznp.js +313 -0
- package/dist/Incentive-rM5nKznp.js.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +38 -16
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +43 -29
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +234 -21
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +46 -32
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts +224 -37
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +234 -30
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +62 -46
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/{Budgets/SimpleBudget.d.ts → Incentives/ERC20VariableCriteriaIncentive.d.ts} +333 -438
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts +231 -29
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.cjs.map +1 -1
- package/dist/Incentives/Incentive.d.ts +4 -4
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +16 -296
- package/dist/Incentives/Incentive.js.map +1 -1
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +40 -18
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +38 -24
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-BDXpY74P.js +133 -0
- package/dist/SimpleDenyList-BDXpY74P.js.map +1 -0
- package/dist/SimpleDenyList-DNj5qDWM.cjs +2 -0
- package/dist/SimpleDenyList-DNj5qDWM.cjs.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +16 -16
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +32 -28
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/claiming.cjs.map +1 -1
- package/dist/claiming.d.ts +1 -1
- package/dist/claiming.js.map +1 -1
- package/dist/componentInterfaces-BBCFkrZv.js +14 -0
- package/dist/componentInterfaces-BBCFkrZv.js.map +1 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs +2 -0
- package/dist/componentInterfaces-DRI_dQ-P.cjs.map +1 -0
- package/dist/deployments-DF_6-7hH.cjs +2 -0
- package/dist/deployments-DF_6-7hH.cjs.map +1 -0
- package/dist/deployments-fJsWblwS.js +56 -0
- package/dist/deployments-fJsWblwS.js.map +1 -0
- package/dist/deployments.json +58 -0
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +256 -20
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +183 -26
- package/dist/errors.js.map +1 -1
- package/dist/{generated-57_Kffpz.js → generated-CsNyWPKA.js} +3843 -2084
- package/dist/generated-CsNyWPKA.js.map +1 -0
- package/dist/generated-DHerxf1y.cjs +3 -0
- package/dist/generated-DHerxf1y.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +142 -108
- package/dist/index.js.map +1 -1
- package/dist/transfers.cjs.map +1 -1
- package/dist/transfers.d.ts +1 -1
- package/dist/transfers.js.map +1 -1
- package/dist/utils.cjs +1 -1
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.ts +26 -12
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +38 -23
- package/dist/utils.js.map +1 -1
- package/package.json +20 -10
- package/src/Actions/Action.test.ts +14 -13
- package/src/Actions/ContractAction.test.ts +10 -10
- package/src/Actions/ContractAction.ts +11 -12
- package/src/Actions/ERC721MintAction.test.ts +6 -6
- package/src/Actions/ERC721MintAction.ts +14 -15
- package/src/Actions/EventAction.test.ts +735 -109
- package/src/Actions/EventAction.ts +527 -88
- package/src/AllowLists/AllowList.test.ts +7 -7
- package/src/AllowLists/AllowList.ts +5 -3
- package/src/AllowLists/OpenAllowList.test.ts +40 -0
- package/src/AllowLists/OpenAllowList.ts +45 -0
- package/src/AllowLists/SimpleAllowList.test.ts +4 -4
- package/src/AllowLists/SimpleAllowList.ts +40 -61
- package/src/AllowLists/SimpleDenyList.test.ts +4 -4
- package/src/AllowLists/SimpleDenyList.ts +41 -17
- package/src/Auth/PassthroughAuth.test.ts +1 -1
- package/src/Boost.ts +21 -24
- package/src/BoostCore.test.ts +361 -306
- package/src/BoostCore.ts +403 -220
- package/src/BoostRegistry.test.ts +53 -0
- package/src/BoostRegistry.ts +161 -40
- package/src/Budgets/Budget.test.ts +2 -2
- package/src/Budgets/Budget.ts +1 -2
- package/src/Budgets/ManagedBudget.test.ts +106 -19
- package/src/Budgets/ManagedBudget.ts +49 -321
- package/src/Budgets/VestingBudget.test.ts +7 -7
- package/src/Budgets/VestingBudget.ts +36 -106
- package/src/Deployable/Contract.ts +4 -5
- package/src/Deployable/Deployable.ts +1 -1
- package/src/Deployable/DeployableTarget.ts +30 -19
- package/src/Deployable/DeployableTargetWithRBAC.test.ts +103 -0
- package/src/Deployable/DeployableTargetWithRBAC.ts +447 -0
- package/src/Incentives/AllowListIncentive.test.ts +12 -12
- package/src/Incentives/AllowListIncentive.ts +30 -15
- package/src/Incentives/CGDAIncentive.test.ts +9 -6
- package/src/Incentives/CGDAIncentive.ts +39 -18
- package/src/Incentives/ERC1155Incentive.test.ts +3 -3
- package/src/Incentives/ERC1155Incentive.ts +30 -29
- package/src/Incentives/ERC20Incentive.test.ts +9 -6
- package/src/Incentives/ERC20Incentive.ts +54 -27
- package/src/Incentives/ERC20VariableCriteriaIncentive.test.ts +184 -0
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +325 -0
- package/src/Incentives/ERC20VariableIncentive.test.ts +8 -11
- package/src/Incentives/ERC20VariableIncentive.ts +50 -26
- package/src/Incentives/Incentive.test.ts +4 -1
- package/src/Incentives/Incentive.ts +7 -6
- package/src/Incentives/PointsIncentive.test.ts +24 -25
- package/src/Incentives/PointsIncentive.ts +32 -17
- package/src/Validators/SignerValidator.test.ts +6 -6
- package/src/Validators/SignerValidator.ts +20 -17
- package/src/Validators/Validator.test.ts +2 -2
- package/src/Validators/Validator.ts +1 -1
- package/src/claiming.ts +1 -1
- package/src/errors.ts +345 -21
- package/src/index.test.ts +118 -36
- package/src/index.ts +5 -0
- package/src/transfers.ts +1 -1
- package/src/utils.test.ts +2 -2
- package/src/utils.ts +61 -12
- package/dist/Budgets/SimpleBudget.d.ts.map +0 -1
- package/dist/componentInterfaces-CKCBwG16.cjs +0 -2
- package/dist/componentInterfaces-CKCBwG16.cjs.map +0 -1
- package/dist/componentInterfaces-DYkaxBda.js +0 -13
- package/dist/componentInterfaces-DYkaxBda.js.map +0 -1
- package/dist/generated-57_Kffpz.js.map +0 -1
- package/dist/generated-wKBNvm48.cjs +0 -3
- package/dist/generated-wKBNvm48.cjs.map +0 -1
- package/src/Budgets/SimpleBudget.test.ts +0 -152
- package/src/Budgets/SimpleBudget.ts +0 -564
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
import { e as h, j as c, I as l, u as d, k as A, m as u, A as R, p as g, M as w, l as y, n as f, o as p, Y as M, q as _ } from "../generated-CsNyWPKA.js";
|
|
2
|
+
import { R as b } from "../generated-CsNyWPKA.js";
|
|
3
|
+
import { DeployableTarget as V } from "./DeployableTarget.js";
|
|
4
|
+
var o = /* @__PURE__ */ ((r) => (r[r.MANAGER = 1n] = "MANAGER", r[r.ADMIN = 2n] = "ADMIN", r))(o || {});
|
|
5
|
+
class v extends V {
|
|
6
|
+
/**
|
|
7
|
+
* Set the authorized status of the given accounts
|
|
8
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
* @async
|
|
12
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
13
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
14
|
+
* @param {?WriteParams} [params]
|
|
15
|
+
* @returns {Promise<void>}
|
|
16
|
+
*/
|
|
17
|
+
async setAuthorized(s, t, a) {
|
|
18
|
+
return await this.awaitResult(
|
|
19
|
+
this.setAuthorizedRaw(s, t, a)
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Set the authorized status of the given accounts
|
|
24
|
+
* The mechanism for managing authorization is left to the implementing contract
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
* @async
|
|
28
|
+
* @param {Address[]} addresses - The accounts to authorize or deauthorize
|
|
29
|
+
* @param {boolean[]} allowed - The authorization status for the given accounts
|
|
30
|
+
* @param {?WriteParams} [params]
|
|
31
|
+
* @returns {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
async setAuthorizedRaw(s, t, a) {
|
|
34
|
+
const { request: e, result: i } = await h(this._config, {
|
|
35
|
+
address: this.assertValidAddress(),
|
|
36
|
+
args: [s, t],
|
|
37
|
+
...this.optionallyAttachAccount(),
|
|
38
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
39
|
+
...a
|
|
40
|
+
});
|
|
41
|
+
return { hash: await c(this._config, e), result: i };
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Grant permissions for a user on the rbac.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* await rbac.grantRoles('0xfoo', Roles.MANAGER)
|
|
49
|
+
* ```
|
|
50
|
+
* @public
|
|
51
|
+
* @async
|
|
52
|
+
* @param {Address} address
|
|
53
|
+
* @param {Roles} role
|
|
54
|
+
* @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]
|
|
55
|
+
* @returns {Promise<void>}
|
|
56
|
+
*/
|
|
57
|
+
async grantRoles(s, t, a) {
|
|
58
|
+
return await this.awaitResult(this.grantRolesRaw(s, t, a));
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Grant permissions for a user on the rbac.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* await rbac.grantRoles('0xfoo', Roles.MANAGER)
|
|
66
|
+
* ```
|
|
67
|
+
* @public
|
|
68
|
+
* @async
|
|
69
|
+
* @param {Address} address
|
|
70
|
+
* @param {Roles} role
|
|
71
|
+
* @param {?WriteParams} [params]
|
|
72
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
73
|
+
*/
|
|
74
|
+
async grantRolesRaw(s, t, a) {
|
|
75
|
+
const { request: e, result: i } = await l(this._config, {
|
|
76
|
+
address: this.assertValidAddress(),
|
|
77
|
+
args: [s, t],
|
|
78
|
+
...this.optionallyAttachAccount(),
|
|
79
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
80
|
+
...a
|
|
81
|
+
});
|
|
82
|
+
return { hash: await d(
|
|
83
|
+
this._config,
|
|
84
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
85
|
+
e
|
|
86
|
+
), result: i };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Revoke permissions for a user on the rbac.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* await rbac.revokeRoles('0xfoo', Roles.MANAGER)
|
|
94
|
+
* ```
|
|
95
|
+
* @public
|
|
96
|
+
* @async
|
|
97
|
+
* @param {Address} address
|
|
98
|
+
* @param {Roles} role
|
|
99
|
+
* @param {?WriteParams} [params]
|
|
100
|
+
* @returns {Promise<void>}
|
|
101
|
+
*/
|
|
102
|
+
async revokeRoles(s, t, a) {
|
|
103
|
+
return await this.awaitResult(this.revokeRolesRaw(s, t, a));
|
|
104
|
+
}
|
|
105
|
+
/**
|
|
106
|
+
* Revoke permissions for a user on the rbac.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* await rbac.revokeRoles('0xfoo', Roles.MANAGER)
|
|
111
|
+
* ```
|
|
112
|
+
* @public
|
|
113
|
+
* @async
|
|
114
|
+
* @param {Address} address
|
|
115
|
+
* @param {Roles} role
|
|
116
|
+
* @param {?WriteParams} [params]
|
|
117
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
118
|
+
*/
|
|
119
|
+
async revokeRolesRaw(s, t, a) {
|
|
120
|
+
const { request: e, result: i } = await A(this._config, {
|
|
121
|
+
address: this.assertValidAddress(),
|
|
122
|
+
args: [s, t],
|
|
123
|
+
...this.optionallyAttachAccount(),
|
|
124
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
125
|
+
...a
|
|
126
|
+
});
|
|
127
|
+
return { hash: await u(
|
|
128
|
+
this._config,
|
|
129
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
130
|
+
e
|
|
131
|
+
), result: i };
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Grant many accounts permissions on the rbac.
|
|
135
|
+
*
|
|
136
|
+
* @example
|
|
137
|
+
* ```ts
|
|
138
|
+
* await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
139
|
+
* ```
|
|
140
|
+
* @public
|
|
141
|
+
* @async
|
|
142
|
+
* @param {Address[]} addresses
|
|
143
|
+
* @param {Roles[]} roles
|
|
144
|
+
* @param {?WriteParams} [params]
|
|
145
|
+
* @returns {Promise<void>}
|
|
146
|
+
*/
|
|
147
|
+
async grantManyRoles(s, t, a) {
|
|
148
|
+
return await this.awaitResult(
|
|
149
|
+
this.grantManyRolesRaw(s, t, a)
|
|
150
|
+
);
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Grant many accounts permissions on the rbac.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```ts
|
|
157
|
+
* await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
158
|
+
* ```
|
|
159
|
+
* @public
|
|
160
|
+
* @async
|
|
161
|
+
* @param {Address[]} addresses
|
|
162
|
+
* @param {Roles[]} roles
|
|
163
|
+
* @param {?WriteParams} [params]
|
|
164
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
165
|
+
*/
|
|
166
|
+
async grantManyRolesRaw(s, t, a) {
|
|
167
|
+
const { request: e, result: i } = await R(this._config, {
|
|
168
|
+
address: this.assertValidAddress(),
|
|
169
|
+
args: [s, t],
|
|
170
|
+
...this.optionallyAttachAccount(),
|
|
171
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
172
|
+
...a
|
|
173
|
+
});
|
|
174
|
+
return { hash: await g(
|
|
175
|
+
this._config,
|
|
176
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
177
|
+
e
|
|
178
|
+
), result: i };
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Revoke many accounts' permissions on the rbac.
|
|
182
|
+
*
|
|
183
|
+
* @example
|
|
184
|
+
* ```ts
|
|
185
|
+
* await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
186
|
+
* ```
|
|
187
|
+
* @public
|
|
188
|
+
* @async
|
|
189
|
+
* @param {Address[]} addresses
|
|
190
|
+
* @param {Roles[]} roles
|
|
191
|
+
* @param {?WriteParams} [params]
|
|
192
|
+
* @returns {Promise<void>}
|
|
193
|
+
*/
|
|
194
|
+
async revokeManyRoles(s, t, a) {
|
|
195
|
+
return await this.awaitResult(
|
|
196
|
+
this.revokeManyRolesRaw(s, t, a)
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Revoke many accounts' permissions on the rbac.
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* ```ts
|
|
204
|
+
* await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])
|
|
205
|
+
* ```
|
|
206
|
+
* @public
|
|
207
|
+
* @async
|
|
208
|
+
* @param {Address[]} addresses
|
|
209
|
+
* @param {Roles[]} roles
|
|
210
|
+
* @param {?WriteParams} [params]
|
|
211
|
+
* @returns {Promise<{ hash: `0x${string}`; result: void; }>}
|
|
212
|
+
*/
|
|
213
|
+
async revokeManyRolesRaw(s, t, a) {
|
|
214
|
+
const { request: e, result: i } = await w(
|
|
215
|
+
this._config,
|
|
216
|
+
{
|
|
217
|
+
address: this.assertValidAddress(),
|
|
218
|
+
args: [s, t],
|
|
219
|
+
...this.optionallyAttachAccount(),
|
|
220
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
221
|
+
...a
|
|
222
|
+
}
|
|
223
|
+
);
|
|
224
|
+
return { hash: await y(
|
|
225
|
+
this._config,
|
|
226
|
+
// biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection
|
|
227
|
+
e
|
|
228
|
+
), result: i };
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Return an array of the roles assigned to the given account.
|
|
232
|
+
* @example
|
|
233
|
+
* ```ts
|
|
234
|
+
* (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)
|
|
235
|
+
* ```
|
|
236
|
+
* @public
|
|
237
|
+
* @param {Address} account
|
|
238
|
+
* @param {?ReadParams} [params]
|
|
239
|
+
* @returns {Promise<Array<Roles>>}
|
|
240
|
+
*/
|
|
241
|
+
async rolesOf(s, t) {
|
|
242
|
+
const a = await f(this._config, {
|
|
243
|
+
address: this.assertValidAddress(),
|
|
244
|
+
args: [s],
|
|
245
|
+
...this.optionallyAttachAccount(),
|
|
246
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
247
|
+
...t
|
|
248
|
+
});
|
|
249
|
+
return [o.MANAGER, o.ADMIN].filter(
|
|
250
|
+
(e) => (a & e) === e
|
|
251
|
+
);
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Returns whether given account has any of the provided roles bitmap.
|
|
255
|
+
*
|
|
256
|
+
* @example
|
|
257
|
+
* ```ts
|
|
258
|
+
* await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)
|
|
259
|
+
* ```
|
|
260
|
+
* @public
|
|
261
|
+
* @param {Address} account
|
|
262
|
+
* @param {Roles} roles
|
|
263
|
+
* @param {?ReadParams} [params]
|
|
264
|
+
* @returns {Promise<boolean>}
|
|
265
|
+
*/
|
|
266
|
+
hasAnyRole(s, t, a) {
|
|
267
|
+
return p(this._config, {
|
|
268
|
+
address: this.assertValidAddress(),
|
|
269
|
+
args: [s, t],
|
|
270
|
+
...this.optionallyAttachAccount(),
|
|
271
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
272
|
+
...a
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
/**
|
|
276
|
+
* Returns whether given account has all of the provided roles bitmap.
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```ts
|
|
280
|
+
* await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)
|
|
281
|
+
* ```
|
|
282
|
+
* @public
|
|
283
|
+
* @param {Address} account
|
|
284
|
+
* @param {Roles} roles
|
|
285
|
+
* @param {?ReadParams} [params]
|
|
286
|
+
* @returns {Promise<boolean>}
|
|
287
|
+
*/
|
|
288
|
+
hasAllRoles(s, t, a) {
|
|
289
|
+
return M(this._config, {
|
|
290
|
+
address: this.assertValidAddress(),
|
|
291
|
+
args: [s, t],
|
|
292
|
+
...this.optionallyAttachAccount(),
|
|
293
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
294
|
+
...a
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* Check if the given account is authorized to use the rbac
|
|
299
|
+
*
|
|
300
|
+
* @public
|
|
301
|
+
* @param {Address} account
|
|
302
|
+
* @param {?ReadParams} [params]
|
|
303
|
+
* @returns {Promise<boolean>} - True if the account is authorized
|
|
304
|
+
*/
|
|
305
|
+
isAuthorized(s, t) {
|
|
306
|
+
return _(this._config, {
|
|
307
|
+
address: this.assertValidAddress(),
|
|
308
|
+
args: [s],
|
|
309
|
+
...this.optionallyAttachAccount(),
|
|
310
|
+
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
311
|
+
...t
|
|
312
|
+
});
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
export {
|
|
316
|
+
v as DeployableTargetWithRBAC,
|
|
317
|
+
o as Roles,
|
|
318
|
+
b as rbacAbi
|
|
319
|
+
};
|
|
320
|
+
//# sourceMappingURL=DeployableTargetWithRBAC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DeployableTargetWithRBAC.js","sources":["../../src/Deployable/DeployableTargetWithRBAC.ts"],"sourcesContent":["import {\n rbacAbi,\n readRbacHasAllRoles,\n readRbacHasAnyRole,\n readRbacIsAuthorized,\n readRbacRolesOf,\n simulateRbacGrantManyRoles,\n simulateRbacGrantRoles,\n simulateRbacRevokeManyRoles,\n simulateRbacRevokeRoles,\n simulateRbacSetAuthorized,\n writeRbacGrantManyRoles,\n writeRbacGrantRoles,\n writeRbacRevokeManyRoles,\n writeRbacRevokeRoles,\n writeRbacSetAuthorized,\n} from '@boostxyz/evm';\nimport type { Abi, Address, ContractEventName } from 'viem';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport type { GenericLog, ReadParams, WriteParams } from '../utils';\nexport { rbacAbi };\n\n/**\n * Enum representing available roles for use with the `RBAC` authorization scheme.\n * `MANAGER` has lowest level of write permissions, for specific implementations, see Budgets and ALlowLists\n * `ADMIN` can additionally manage authorized users on the contract.\n *\n * @export\n * @type {{ readonly MANAGER: 1n; readonly ADMIN_ROLE: 2n; }}\n * @enum {bigint}\n */\nexport enum Roles {\n //@ts-expect-error ts doesn't like bigint enum values\n MANAGER = 1n,\n //@ts-expect-error ts doesn't like bigint enum values\n ADMIN = 2n,\n}\n\n/**\n * A generic `viem.Log` event with support for `Rbac` event types.\n *\n * @export\n * @typedef {RBACLog}\n * @template {ContractEventName<typeof rbacAbi>} [event=ContractEventName<\n * typeof rbacAbi\n * >]\n */\nexport type RBACLog<\n event extends ContractEventName<typeof rbacAbi> = ContractEventName<\n typeof rbacAbi\n >,\n> = GenericLog<typeof rbacAbi, event>;\n\n/**\n * A minimal RBAC implementation that offers MANAGER and ADMIN roles, and\n * Budgets and allowlists support this auth scheme\n *\n * @export\n * @class DeployableTargetWithRBAC\n * @typedef {DeployableTargetWithRBAC}\n * @extends {DeployableTarget<RbacPayload>}\n */\nexport class DeployableTargetWithRBAC<\n Payload,\n ABI extends Abi,\n> extends DeployableTarget<Payload, ABI> {\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorized(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n return await this.awaitResult(\n this.setAuthorizedRaw(addresses, allowed, params),\n );\n }\n\n /**\n * Set the authorized status of the given accounts\n * The mechanism for managing authorization is left to the implementing contract\n *\n * @public\n * @async\n * @param {Address[]} addresses - The accounts to authorize or deauthorize\n * @param {boolean[]} allowed - The authorization status for the given accounts\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async setAuthorizedRaw(\n addresses: Address[],\n allowed: boolean[],\n params?: WriteParams<typeof rbacAbi, 'setAuthorized'>,\n ) {\n const { request, result } = await simulateRbacSetAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, allowed],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacSetAuthorized(this._config, request);\n return { hash, result };\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams<typeof rbacAbi, 'grantRoles'>} [params]\n * @returns {Promise<void>}\n */\n public async grantRoles(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n return await this.awaitResult(this.grantRolesRaw(address, role, params));\n }\n\n /**\n * Grant permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'grantRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacGrantRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeRoles(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n return await this.awaitResult(this.revokeRolesRaw(address, role, params));\n }\n\n /**\n * Revoke permissions for a user on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeRoles('0xfoo', Roles.MANAGER)\n * ```\n * @public\n * @async\n * @param {Address} address\n * @param {Roles} role\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeRolesRaw(\n address: Address,\n role: Roles,\n params?: WriteParams<typeof rbacAbi, 'revokeRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeRoles(this._config, {\n address: this.assertValidAddress(),\n args: [address, role],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacRevokeRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async grantManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>,\n ) {\n return await this.awaitResult(\n this.grantManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Grant many accounts permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.grantManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async grantManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'grantManyRoles'>,\n ) {\n const { request, result } = await simulateRbacGrantManyRoles(this._config, {\n address: this.assertValidAddress(),\n args: [addresses, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeRbacGrantManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async revokeManyRoles(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>,\n ) {\n return await this.awaitResult(\n this.revokeManyRolesRaw(addresses, roles, params),\n );\n }\n\n /**\n * Revoke many accounts' permissions on the rbac.\n *\n * @example\n * ```ts\n * await rbac.revokeManyRoles(['0xfoo', '0xbar], [Roles.MANAGER, Roles.ADMIN])\n * ```\n * @public\n * @async\n * @param {Address[]} addresses\n * @param {Roles[]} roles\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async revokeManyRolesRaw(\n addresses: Address[],\n roles: Roles[],\n params?: WriteParams<typeof rbacAbi, 'revokeManyRoles'>,\n ) {\n const { request, result } = await simulateRbacRevokeManyRoles(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [addresses, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeRbacRevokeManyRoles(\n this._config,\n // biome-ignore lint/suspicious/noExplicitAny: negligible low level lack of type intersection\n request as any,\n );\n return { hash, result };\n }\n\n /**\n * Return an array of the roles assigned to the given account.\n * @example\n * ```ts\n * (await rbac.rolesOf(0xfoo)).includes(Roles.ADMIN)\n * ```\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<Array<Roles>>}\n */\n public async rolesOf(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'rolesOf'>,\n ) {\n const roles = await readRbacRolesOf(this._config, {\n address: this.assertValidAddress(),\n args: [account],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return ([Roles.MANAGER, Roles.ADMIN] as unknown as Array<bigint>).filter(\n (role) => (roles & role) === role,\n ) as unknown as Roles[];\n }\n\n /**\n * Returns whether given account has any of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAnyRole(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAnyRole(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAnyRole'>,\n ) {\n return readRbacHasAnyRole(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Returns whether given account has all of the provided roles bitmap.\n *\n * @example\n * ```ts\n * await rbac.hasAllRoles(0xfoo, Roles.ADMIN | Roles.MANAGER)\n * ```\n * @public\n * @param {Address} account\n * @param {Roles} roles\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public hasAllRoles(\n account: Address,\n roles: Roles,\n params?: ReadParams<typeof rbacAbi, 'hasAllRoles'>,\n ) {\n return readRbacHasAllRoles(this._config, {\n address: this.assertValidAddress(),\n args: [account, roles],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if the given account is authorized to use the rbac\n *\n * @public\n * @param {Address} account\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the account is authorized\n */\n public isAuthorized(\n account: Address,\n params?: ReadParams<typeof rbacAbi, 'isAuthorized'>,\n ) {\n return readRbacIsAuthorized(this._config, {\n address: this.assertValidAddress(),\n args: [account],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n}\n"],"names":["Roles","DeployableTargetWithRBAC","DeployableTarget","addresses","allowed","params","request","result","simulateRbacSetAuthorized","writeRbacSetAuthorized","address","role","simulateRbacGrantRoles","writeRbacGrantRoles","simulateRbacRevokeRoles","writeRbacRevokeRoles","roles","simulateRbacGrantManyRoles","writeRbacGrantManyRoles","simulateRbacRevokeManyRoles","writeRbacRevokeManyRoles","account","readRbacRolesOf","readRbacHasAnyRole","readRbacHasAllRoles","readRbacIsAuthorized"],"mappings":";;;AA+BY,IAAAA,sBAAAA,OAEVA,EAAAA,EAAA,UAAU,EAAV,IAAA,WAEAA,EAAAA,EAAA,QAAQ,EAAR,IAAA,SAJUA,IAAAA,KAAA,CAAA,CAAA;AA+BL,MAAMC,UAGHC,EAA+B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYvC,MAAa,cACXC,GACAC,GACAC,GACA;AACA,WAAO,MAAM,KAAK;AAAA,MAChB,KAAK,iBAAiB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;AAAA,MACjC,MAAM,CAACF,GAASL,CAAK;AAAA,MACrB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIX;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAeO,YACLgB,GACAL,GACAX,GACA;AACO,WAAAmB,EAAoB,KAAK,SAAS;AAAA,MACvC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACH,GAASL,CAAK;AAAA,MACrB,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIX;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUO,aACLgB,GACAhB,GACA;AACO,WAAAoB,EAAqB,KAAK,SAAS;AAAA,MACxC,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAACJ,CAAO;AAAA,MACd,GAAG,KAAK,wBAAwB;AAAA;AAAA,MAEhC,GAAIhB;AAAA,IAAA,CACL;AAAA,EACH;AACF;"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";const e=require("./generated-DHerxf1y.cjs"),c=require("./componentInterfaces-DRI_dQ-P.cjs"),h=require("@wagmi/core"),A=require("./errors.cjs"),y=require("./Incentives/AllowListIncentive.cjs"),w=require("./Incentives/CGDAIncentive.cjs"),m=require("./Incentives/ERC20Incentive.cjs"),o=require("viem"),g=require("./deployments-DF_6-7hH.cjs"),p=require("./Deployable/DeployableTarget.cjs"),r=require("./claiming.cjs"),I=require("./utils.cjs"),C=require("./Incentives/PointsIncentive.cjs"),v="0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550348015610062575f80fd5b5061007161007660201b60201c565b61010b565b5f6100856100e260201b60201c565b90508054600181161561009f5763f92ee8a95f526004601cfd5b8160c01c808260011c146100dd578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b61266f806101185f395ff3fe6080604052600436106101ed575f3560e01c806354d1f13d1161010c578063d54ad2a11161009f578063ec87621c1161006e578063ec87621c1461069a578063f04e283e146106c4578063f2fde38b146106e0578063fe9fbb80146106fc578063fee81cf414610738576101ed565b8063d54ad2a1146105e2578063db09da121461060c578063dcc2136114610648578063dcc59b6f14610670576101ed565b8063a4d66daf116100db578063a4d66daf14610518578063bb1757cf14610542578063be4994f81461057e578063c884ef83146105a6576101ed565b806354d1f13d146104b0578063715018a6146104ba57806375b238fc146104c45780638da5cb5b146104ee576101ed565b80632de9480711610184578063474f5a4411610153578063474f5a44146103df5780634a4ee7b11461041c5780634e7165a214610438578063514e62fc14610474576101ed565b80632de948071461032957806338d52e0f146103655780634359d28a1461038f578063439fab91146103b7576101ed565b80631cd64df4116101c05780631cd64df41461028f578063228cb733146102cb57806325692962146102f557806328d6183b146102ff576101ed565b806301ffc9a7146101f157806307621eca1461022d578063183a4f6e146102575780631c10893f14610273575b5f80fd5b3480156101fc575f80fd5b5061021760048036038101906102129190611870565b610774565b60405161022491906118b5565b60405180910390f35b348015610238575f80fd5b506102416107ed565b60405161024e91906118e6565b60405180910390f35b610271600480360381019061026c9190611929565b6107f6565b005b61028d600480360381019061028891906119ae565b610803565b005b34801561029a575f80fd5b506102b560048036038101906102b091906119ae565b610819565b6040516102c291906118b5565b60405180910390f35b3480156102d6575f80fd5b506102df61082f565b6040516102ec91906118e6565b60405180910390f35b6102fd610835565b005b34801561030a575f80fd5b50610313610886565b60405161032091906119fb565b60405180910390f35b348015610334575f80fd5b5061034f600480360381019061034a9190611a14565b6108ad565b60405161035c91906118e6565b60405180910390f35b348015610370575f80fd5b506103796108c6565b6040516103869190611a4e565b60405180910390f35b34801561039a575f80fd5b506103b560048036038101906103b09190611b1d565b6108e9565b005b3480156103c2575f80fd5b506103dd60048036038101906103d89190611bf0565b6109f7565b005b3480156103ea575f80fd5b5061040560048036038101906104009190611bf0565b610bb4565b604051610413929190611c3b565b60405180910390f35b610436600480360381019061043191906119ae565b610d18565b005b348015610443575f80fd5b5061045e60048036038101906104599190611bf0565b610d2e565b60405161046b9190611cd2565b60405180910390f35b34801561047f575f80fd5b5061049a600480360381019061049591906119ae565b610dfc565b6040516104a791906118b5565b60405180910390f35b6104b8610e13565b005b6104c2610e4c565b005b3480156104cf575f80fd5b506104d8610e5f565b6040516104e591906118e6565b60405180910390f35b3480156104f9575f80fd5b50610502610e64565b60405161050f9190611a4e565b60405180910390f35b348015610523575f80fd5b5061052c610e8c565b60405161053991906118e6565b60405180910390f35b34801561054d575f80fd5b5061056860048036038101906105639190611cf2565b610e92565b60405161057591906118b5565b60405180910390f35b348015610589575f80fd5b506105a4600480360381019061059f9190611da4565b611086565b005b3480156105b1575f80fd5b506105cc60048036038101906105c79190611a14565b61113c565b6040516105d991906118b5565b60405180910390f35b3480156105ed575f80fd5b506105f6611159565b60405161060391906118e6565b60405180910390f35b348015610617575f80fd5b50610632600480360381019061062d9190611cf2565b61115f565b60405161063f91906118b5565b60405180910390f35b348015610653575f80fd5b5061066e60048036038101906106699190611da4565b611172565b005b34801561067b575f80fd5b50610684611228565b60405161069191906118e6565b60405180910390f35b3480156106a5575f80fd5b506106ae61122e565b6040516106bb91906118e6565b60405180910390f35b6106de60048036038101906106d99190611a14565b611233565b005b6106fa60048036038101906106f59190611a14565b611271565b005b348015610707575f80fd5b50610722600480360381019061071d9190611a14565b61129a565b60405161072f91906118b5565b60405180910390f35b348015610743575f80fd5b5061075e60048036038101906107599190611a14565b6112ed565b60405161076b91906118e6565b60405180910390f35b5f7f90318111000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107e657506107e582611306565b5b9050919050565b5f600254905090565b610800338261137f565b50565b61080b61138e565b61081582826113c5565b5050565b5f8182610825856108ad565b1614905092915050565b60025481565b5f61083e6113d5565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f9031811100000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60026108f4816113df565b828290508585905014610933576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156109ef575f84848381811061095457610953611e22565b5b90506020020160208101906109699190611e79565b905060011515811515036109ae576109a987878481811061098d5761098c611e22565b5b90506020020160208101906109a29190611a14565b60016113c5565b6109e1565b6109e08787848181106109c4576109c3611e22565b5b90506020020160208101906109d99190611a14565b600161137f565b5b508080600101915050610935565b505050505050565b5f610a00611414565b90508054600382558015610a325760018160011c14303b10610a295763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610a439190611f85565b90505f815f015190505f826020015190505f836040015190505f8103610a95576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610abf308573ffffffffffffffffffffffffffffffffffffffff1661143d90919063ffffffff16565b905081811015610b0d57845f015181836040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610b0493929190611fb0565b60405180910390fd5b835f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555082600281905550816004819055505f600581905550610b6a33611470565b610b75336001611546565b50505050508015610baf576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610bc181611587565b5f8585810190610bd191906120fe565b90505f8160200151806020019051810190610bec9190612159565b90508060045f828254610bff91906121b1565b92505081905550610c53825f0151825f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115ae9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610cc593929190612249565b604051602081830303815290604052604051610ce19190611cd2565b60405180910390a2805f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094505050509250929050565b610d2061138e565b610d2a828261137f565b5050565b60605f808484810190610d4191906122c0565b9250509150604051806080016040528060016002811115610d6557610d64612310565b5b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610dc19190612366565b604051602081830303815290604052815250604051602001610de3919061247c565b6040516020818303038152906040529250505092915050565b5f8082610e08856108ad565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610e5461138e565b610e5d5f6115f7565b565b600281565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60045481565b5f610e9b61138e565b5f8383810190610eab9190612521565b90505f8160200151806020019051810190610ec69190612159565b90505f610ed2876116bd565b610f08576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60025403610f1957819050610f3d565b670de0b6b3a764000082600254610f309190612568565b610f3a91906125d6565b90505b60045481600554610f4e9190612606565b1115610f86576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f828254610f979190612606565b92505081905550610fe887825f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166115ae9092919063ffffffff16565b8673ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16898460405160200161105493929190612249565b6040516020818303038152906040526040516110709190611cd2565b60405180910390a2600193505050509392505050565b6002611091816113df565b8282905085859050146110d0576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015611134576111278686838181106110f3576110f2611e22565b5b90506020020160208101906111089190611a14565b85858481811061111b5761111a611e22565b5b905060200201356113c5565b80806001019150506110d2565b505050505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b60055481565b5f611169846116bd565b90509392505050565b600261117d816113df565b8282905085859050146111bc576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015611220576112138686838181106111df576111de611e22565b5b90506020020160208101906111f49190611a14565b85858481811061120757611206611e22565b5b9050602002013561137f565b80806001019150506111be565b505050505050565b60015481565b600181565b61123b61138e565b63389a75e1600c52805f526020600c20805442111561126157636f5e88185f526004601cfd5b5f81555061126e816115f7565b50565b61127961138e565b8060601b61128e57637448fbae5f526004601cfd5b611297816115f7565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff166112ba610e64565b73ffffffffffffffffffffffffffffffffffffffff1614806112e657506112e5826002600117610dfc565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806113785750611377826116cc565b5b9050919050565b61138a82825f611745565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739275433146113c3576382b429005f526004601cfd5b565b6113d182826001611745565b5050565b5f6202a300905090565b638b78c6d81954331461141157638b78c6d8600c52335f52806020600c205416611410576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b61147861179d565b156114f0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278054156114b257630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350611543565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b638b78c6d8600c52335f52806020600c2054166115ab576382b429005f526004601cfd5b50565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f511417166115ee576390b8ec185f526004601cfd5b5f603452505050565b6115ff61179d565b15611664577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b82178155506116ba565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f600454600554109050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061173e575061173d826117a1565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361176757848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b61184f8161181b565b8114611859575f80fd5b50565b5f8135905061186a81611846565b92915050565b5f6020828403121561188557611884611813565b5b5f6118928482850161185c565b91505092915050565b5f8115159050919050565b6118af8161189b565b82525050565b5f6020820190506118c85f8301846118a6565b92915050565b5f819050919050565b6118e0816118ce565b82525050565b5f6020820190506118f95f8301846118d7565b92915050565b611908816118ce565b8114611912575f80fd5b50565b5f81359050611923816118ff565b92915050565b5f6020828403121561193e5761193d611813565b5b5f61194b84828501611915565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f61197d82611954565b9050919050565b61198d81611973565b8114611997575f80fd5b50565b5f813590506119a881611984565b92915050565b5f80604083850312156119c4576119c3611813565b5b5f6119d18582860161199a565b92505060206119e285828601611915565b9150509250929050565b6119f58161181b565b82525050565b5f602082019050611a0e5f8301846119ec565b92915050565b5f60208284031215611a2957611a28611813565b5b5f611a368482850161199a565b91505092915050565b611a4881611973565b82525050565b5f602082019050611a615f830184611a3f565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611a8857611a87611a67565b5b8235905067ffffffffffffffff811115611aa557611aa4611a6b565b5b602083019150836020820283011115611ac157611ac0611a6f565b5b9250929050565b5f8083601f840112611add57611adc611a67565b5b8235905067ffffffffffffffff811115611afa57611af9611a6b565b5b602083019150836020820283011115611b1657611b15611a6f565b5b9250929050565b5f805f8060408587031215611b3557611b34611813565b5b5f85013567ffffffffffffffff811115611b5257611b51611817565b5b611b5e87828801611a73565b9450945050602085013567ffffffffffffffff811115611b8157611b80611817565b5b611b8d87828801611ac8565b925092505092959194509250565b5f8083601f840112611bb057611baf611a67565b5b8235905067ffffffffffffffff811115611bcd57611bcc611a6b565b5b602083019150836001820283011115611be957611be8611a6f565b5b9250929050565b5f8060208385031215611c0657611c05611813565b5b5f83013567ffffffffffffffff811115611c2357611c22611817565b5b611c2f85828601611b9b565b92509250509250929050565b5f604082019050611c4e5f8301856118d7565b611c5b6020830184611a3f565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611ca482611c62565b611cae8185611c6c565b9350611cbe818560208601611c7c565b611cc781611c8a565b840191505092915050565b5f6020820190508181035f830152611cea8184611c9a565b905092915050565b5f805f60408486031215611d0957611d08611813565b5b5f611d168682870161199a565b935050602084013567ffffffffffffffff811115611d3757611d36611817565b5b611d4386828701611b9b565b92509250509250925092565b5f8083601f840112611d6457611d63611a67565b5b8235905067ffffffffffffffff811115611d8157611d80611a6b565b5b602083019150836020820283011115611d9d57611d9c611a6f565b5b9250929050565b5f805f8060408587031215611dbc57611dbb611813565b5b5f85013567ffffffffffffffff811115611dd957611dd8611817565b5b611de587828801611a73565b9450945050602085013567ffffffffffffffff811115611e0857611e07611817565b5b611e1487828801611d4f565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b611e588161189b565b8114611e62575f80fd5b50565b5f81359050611e7381611e4f565b92915050565b5f60208284031215611e8e57611e8d611813565b5b5f611e9b84828501611e65565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b611ede82611c8a565b810181811067ffffffffffffffff82111715611efd57611efc611ea8565b5b80604052505050565b5f611f0f61180a565b9050611f1b8282611ed5565b919050565b5f80fd5b5f60608284031215611f3957611f38611ea4565b5b611f436060611f06565b90505f611f528482850161199a565b5f830152506020611f6584828501611915565b6020830152506040611f7984828501611915565b60408301525092915050565b5f60608284031215611f9a57611f99611813565b5b5f611fa784828501611f24565b91505092915050565b5f606082019050611fc35f830186611a3f565b611fd060208301856118d7565b611fdd60408301846118d7565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561200357612002611ea8565b5b61200c82611c8a565b9050602081019050919050565b828183375f83830152505050565b5f61203961203484611fe9565b611f06565b90508281526020810184848401111561205557612054611fe5565b5b612060848285612019565b509392505050565b5f82601f83011261207c5761207b611a67565b5b813561208c848260208601612027565b91505092915050565b5f604082840312156120aa576120a9611ea4565b5b6120b46040611f06565b90505f6120c38482850161199a565b5f83015250602082013567ffffffffffffffff8111156120e6576120e5611f20565b5b6120f284828501612068565b60208301525092915050565b5f6020828403121561211357612112611813565b5b5f82013567ffffffffffffffff8111156121305761212f611817565b5b61213c84828501612095565b91505092915050565b5f81519050612153816118ff565b92915050565b5f6020828403121561216e5761216d611813565b5b5f61217b84828501612145565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6121bb826118ce565b91506121c6836118ce565b92508282039050818111156121de576121dd612184565b5b92915050565b5f8160601b9050919050565b5f6121fa826121e4565b9050919050565b5f61220b826121f0565b9050919050565b61222361221e82611973565b612201565b82525050565b5f819050919050565b61224361223e826118ce565b612229565b82525050565b5f6122548286612212565b6014820191506122648285612212565b6014820191506122748284612232565b602082019150819050949350505050565b5f61228f82611954565b9050919050565b61229f81612285565b81146122a9575f80fd5b50565b5f813590506122ba81612296565b92915050565b5f805f606084860312156122d7576122d6611813565b5b5f6122e4868287016122ac565b93505060206122f586828701611915565b925050604061230686828701611915565b9150509250925092565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b612346816118ce565b82525050565b602082015f8201516123605f85018261233d565b50505050565b5f6020820190506123795f83018461234c565b92915050565b600381106123905761238f612310565b5b50565b5f8190506123a08261237f565b919050565b5f6123af82612393565b9050919050565b6123bf816123a5565b82525050565b6123ce81611973565b82525050565b5f82825260208201905092915050565b5f6123ee82611c62565b6123f881856123d4565b9350612408818560208601611c7c565b61241181611c8a565b840191505092915050565b5f608083015f8301516124315f8601826123b6565b50602083015161244460208601826123c5565b50604083015161245760408601826123c5565b506060830151848203606086015261246f82826123e4565b9150508091505092915050565b5f6020820190508181035f830152612494818461241c565b905092915050565b5f604082840312156124b1576124b0611ea4565b5b6124bb6040611f06565b90505f82013567ffffffffffffffff8111156124da576124d9611f20565b5b6124e684828501612068565b5f83015250602082013567ffffffffffffffff81111561250957612508611f20565b5b61251584828501612068565b60208301525092915050565b5f6020828403121561253657612535611813565b5b5f82013567ffffffffffffffff81111561255357612552611817565b5b61255f8482850161249c565b91505092915050565b5f612572826118ce565b915061257d836118ce565b925082820261258b816118ce565b915082820484148315176125a2576125a1612184565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f6125e0826118ce565b91506125eb836118ce565b9250826125fb576125fa6125a9565b5b828204905092915050565b5f612610826118ce565b915061261b836118ce565b925082820190508082111561263357612632612184565b5b9291505056fea2646970667358221220c9b4477393b8df7d77976f789b1b87546d0b8d15d6e9d3de17467d10b6d3fe5664736f6c634300081a0033",i=class i extends p.DeployableTarget{constructor(){super(...arguments),this.abi=e.f}async owner(f){return await e.AA(this._config,{address:this.assertValidAddress(),args:[],...f})}async totalClaimed(f){return await e.RA(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return await e.cA(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await e.dA(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await e.yA(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await e.lA(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return await e.hA(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return await e.TA(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:a,result:d}=await e.UA(this._config,{address:this.assertValidAddress(),args:[r.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.CA(this._config,a),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:a,result:d}=await e.ZA(this._config,{address:this.assertValidAddress(),args:[r.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await e.zA(this._config,a),result:d}}async isClaimable(f,b){return await e.wA(this._config,{address:this.assertValidAddress(),args:[r.prepareClaimPayload(f)],...b})}buildClaimData(f){return o.encodeAbiParameters([{type:"uint256",name:"rewardAmount"}],[f])}buildParameters(f,b){const[a,d]=this.validateDeploymentConfig(f,b);return{abi:e.f,bytecode:v,args:[l(a)],...this.optionallyAttachAccount(d.account)}}};i.bases={31337:void 0,...g.ERC20VariableIncentive},i.registryType=I.RegistryType.INCENTIVE;let s=i;function l({asset:t,reward:f,limit:b}){return o.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"}],[t,f,b])}const n={[c.APointsIncentive]:C.PointsIncentive,[c.AERC20Incentive]:m.ERC20Incentive,[c.AAllowListIncentive]:y.AllowListIncentive,[c.ACGDAIncentive]:w.CGDAIncentive,[c.AERC20VariableIncentive]:s};async function q(t,f){const b=await h.readContract(t.config,{abi:e.W,functionName:"getComponentInterface",address:f}),a=n[b];if(!a)throw new A.InvalidComponentInterfaceError(Object.keys(n),b);return new a(t,f)}exports.ERC20VariableIncentive=s;exports.IncentiveByComponentInterface=n;exports.incentiveFromAddress=q;exports.prepareERC20VariableIncentivePayload=l;
|
|
2
|
+
//# sourceMappingURL=Incentive-CcnOIc8L.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Incentive-CcnOIc8L.cjs","sources":["../src/Incentives/ERC20VariableIncentive.ts","../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20VariableIncentiveAbi,\n readErc20VariableIncentiveAsset,\n readErc20VariableIncentiveClaimed,\n readErc20VariableIncentiveClaims,\n readErc20VariableIncentiveCurrentReward,\n readErc20VariableIncentiveIsClaimable,\n readErc20VariableIncentiveLimit,\n readErc20VariableIncentiveOwner,\n readErc20VariableIncentiveReward,\n readErc20VariableIncentiveTotalClaimed,\n simulateErc20VariableIncentiveClaim,\n simulateErc20VariableIncentiveClawback,\n writeErc20VariableIncentiveClaim,\n writeErc20VariableIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableIncentive.sol/ERC20VariableIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n} from 'viem';\nimport { ERC20VariableIncentive as ERC20VariableIncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20VariableIncentiveAbi };\n/**\n * The object representation of a `ERC20VariableIncentivePayload.InitPayload`\n *\n * @export\n * @interface ERC20VariableIncentivePayload\n * @typedef {ERC20VariableIncentivePayload}\n */\nexport interface ERC20VariableIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The entity that can `clawback` funds\n *\n * @type {Address}\n */\n manager: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20VariableIncentive` event types.\n *\n * @export\n * @typedef {ERC20VariableIncentiveLog}\n * @template {ContractEventName<typeof erc20VariableIncentiveAbi>} [event=ContractEventName<\n * typeof erc20VariableIncentiveAbi\n * >]\n */\nexport type ERC20VariableIncentiveLog<\n event extends ContractEventName<\n typeof erc20VariableIncentiveAbi\n > = ContractEventName<typeof erc20VariableIncentiveAbi>,\n> = GenericLog<typeof erc20VariableIncentiveAbi, event>;\n\n/**\n * A modified ERC20 incentive implementation that allows claiming of variable token amounts with a spending limit\n *\n * @export\n * @class ERC20VariableIncentive\n * @typedef {ERC20VariableIncentive}\n * @extends {DeployableTarget<ERC20VariableIncentivePayload>}\n */\nexport class ERC20VariableIncentive extends DeployableTarget<\n ERC20VariableIncentivePayload,\n typeof erc20VariableIncentiveAbi\n> {\n public override readonly abi = erc20VariableIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_VARIABLE_INCENTIVE_BASE,\n ...(ERC20VariableIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'owner'>,\n ) {\n return await readErc20VariableIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'totalClaimed'>,\n ) {\n return await readErc20VariableIncentiveTotalClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The current reward\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'currentReward'>,\n ) {\n return await readErc20VariableIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claims'>,\n ) {\n return await readErc20VariableIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(\n address: Address,\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'claimed'>,\n ) {\n return await readErc20VariableIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'asset'>,\n ) {\n return await readErc20VariableIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'reward'>,\n ) {\n return await readErc20VariableIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(\n params?: ReadParams<typeof erc20VariableIncentiveAbi, 'limit'>,\n ) {\n return await readErc20VariableIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'claim'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20VariableIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(\n payload: ClaimPayload,\n params?: WriteParams<typeof erc20VariableIncentiveAbi, 'clawback'>,\n ) {\n const { request, result } = await simulateErc20VariableIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20VariableIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [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 erc20VariableIncentiveAbi, 'isClaimable'>,\n ) {\n return await readErc20VariableIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Builds the claim data for the ERC20VariableIncentive.\n *\n * @public\n * @param {bigint} rewardAmount\n * @returns {Hex} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20VariableIncentive.\n */\n public buildClaimData(rewardAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'rewardAmount' }],\n [rewardAmount],\n );\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Given a {@link ERC20VariableIncentivePayload}, properly encode a ` ERC20VariableIncentive.InitPayload` for use with {@link ERC20VariableIncentive} initialization.\n *\n * @param {ERC20VariableIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @returns {Hex}\n */\nexport function prepareERC20VariableIncentivePayload({\n asset,\n reward,\n limit,\n}: ERC20VariableIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n ],\n [asset, reward, limit],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20VariableIncentive,\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport type { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n PointsIncentive,\n ERC20VariableIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | PointsIncentive\n | ERC20VariableIncentive\n | ERC20VariableCriteriaIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x4414fbb4\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0xa8e4af1e\": typeof ERC20VariableIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n [AAllowListIncentive]: AllowListIncentive,\n // [AERC1155Incentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Incentive}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20VariableIncentive","DeployableTarget","erc20VariableIncentiveAbi","params","readErc20VariableIncentiveOwner","readErc20VariableIncentiveTotalClaimed","readErc20VariableIncentiveCurrentReward","readErc20VariableIncentiveClaims","address","readErc20VariableIncentiveClaimed","readErc20VariableIncentiveAsset","readErc20VariableIncentiveReward","readErc20VariableIncentiveLimit","payload","request","result","simulateErc20VariableIncentiveClaim","prepareClaimPayload","writeErc20VariableIncentiveClaim","simulateErc20VariableIncentiveClawback","writeErc20VariableIncentiveClawback","readErc20VariableIncentiveIsClaimable","rewardAmount","encodeAbiParameters","_payload","_options","options","bytecode","prepareERC20VariableIncentivePayload","ERC20VariableIncentiveBases","RegistryType","ERC20VariableIncentive","asset","reward","limit","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AAllowListIncentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":"uwoBA+FaA,EAAN,M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