@boostxyz/sdk 6.0.0 → 6.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Actions/Action.cjs +1 -1
- package/dist/Actions/Action.js +2 -2
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.js +40 -40
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts +2 -2
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +14 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +119 -101
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.js +2 -2
- package/dist/Budget-CsqSI4NH.cjs +2 -0
- package/dist/Budget-CsqSI4NH.cjs.map +1 -0
- package/dist/Budget-bMiAGF8s.js +922 -0
- package/dist/Budget-bMiAGF8s.js.map +1 -0
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.d.ts +5 -4
- package/dist/Budgets/Budget.d.ts.map +1 -1
- package/dist/Budgets/Budget.js +3 -3
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.js +2 -2
- package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts +1331 -0
- package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts.map +1 -0
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.js +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +2 -2
- package/dist/{Incentive-Boviez4z.js → Incentive-DZLG6T1-.js} +27 -27
- package/dist/{Incentive-Boviez4z.js.map → Incentive-DZLG6T1-.js.map} +1 -1
- package/dist/{Incentive-wM4zizTH.cjs → Incentive-DvNdIJ_x.cjs} +2 -2
- package/dist/{Incentive-wM4zizTH.cjs.map → Incentive-DvNdIJ_x.cjs.map} +1 -1
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.js +3 -3
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.js +2 -2
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.js +2 -2
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +2 -2
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +2 -2
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +3 -3
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.js +2 -2
- package/dist/{SimpleDenyList-Cybtz7AK.cjs → SimpleDenyList-BAIrFBAW.cjs} +2 -2
- package/dist/{SimpleDenyList-Cybtz7AK.cjs.map → SimpleDenyList-BAIrFBAW.cjs.map} +1 -1
- package/dist/{SimpleDenyList-CW4RwwRw.js → SimpleDenyList-C734XLxt.js} +11 -11
- package/dist/{SimpleDenyList-CW4RwwRw.js.map → SimpleDenyList-C734XLxt.js.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +2 -2
- package/dist/Validators/LimitedSignerValidator.js.map +1 -1
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts +1 -1
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +2 -2
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +2 -2
- package/dist/componentInterfaces-5Ezh3Pvx.js +19 -0
- package/dist/componentInterfaces-5Ezh3Pvx.js.map +1 -0
- package/dist/componentInterfaces-Cm4Zfn1v.cjs +2 -0
- package/dist/componentInterfaces-Cm4Zfn1v.cjs.map +1 -0
- package/dist/{deployments-DqjtOTUr.js → deployments-3RHH-eW7.js} +3 -3
- package/dist/{deployments-DqjtOTUr.js.map → deployments-3RHH-eW7.js.map} +1 -1
- package/dist/errors.cjs +1 -1
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.js +1 -1
- package/dist/errors.js.map +1 -1
- package/dist/generated-BPiHi7W2.cjs +3 -0
- package/dist/{generated-DgXPUgXl.cjs.map → generated-BPiHi7W2.cjs.map} +1 -1
- package/dist/{generated-pJZHmRCK.js → generated-CElkFqkY.js} +1315 -682
- package/dist/{generated-pJZHmRCK.js.map → generated-CElkFqkY.js.map} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -152
- package/package.json +2 -2
- package/src/AllowLists/SimpleAllowList.ts +2 -2
- package/src/BoostCore.ts +36 -4
- package/src/Budgets/Budget.ts +8 -2
- package/src/Budgets/ManagedBudgetWithFees.test.ts +0 -1
- package/src/Budgets/ManagedBudgetWithFeesV2.test.ts +327 -0
- package/src/Budgets/ManagedBudgetWithFeesV2.ts +713 -0
- package/src/Validators/LimitedSignerValidator.ts +1 -1
- package/src/Validators/SignerValidator.ts +1 -1
- package/src/errors.ts +1 -1
- package/src/index.ts +1 -0
- package/dist/Budget-DMbfdTom.cjs +0 -2
- package/dist/Budget-DMbfdTom.cjs.map +0 -1
- package/dist/Budget-DO6sGTIR.js +0 -463
- package/dist/Budget-DO6sGTIR.js.map +0 -1
- package/dist/componentInterfaces-D7r9xJmt.cjs +0 -2
- package/dist/componentInterfaces-D7r9xJmt.cjs.map +0 -1
- package/dist/componentInterfaces-PR3ijhgZ.js +0 -18
- package/dist/componentInterfaces-PR3ijhgZ.js.map +0 -1
- package/dist/generated-DgXPUgXl.cjs +0 -3
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ManagedBudgetWithFeesV2.d.ts","sourceRoot":"","sources":["../../src/Budgets/ManagedBudgetWithFeesV2.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0BAA0B,EAsB3B,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAIT,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,wBAAwB,EACxB,KAAK,KAAK,EACX,MAAM,wCAAwC,CAAC;AAEhD,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,0BAA0B,EAAE,CAAC;AACtC,YAAY,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,CAAC;AAEhE;;;;;;GAMG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;;;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AM,CAAC,EAAE,WAAW;IAMzE;;;;;;;OAOG;IACU,mBAAmB,CAC9B,aAAa,EAAE,MAAM,EACrB,MAAM,CAAC,EAAE,WAAW;;;;IAiBtB;;;;;OAKG;IACU,aAAa,CAAC,MAAM,CAAC,EAAE,UAAU;IAS9C;;;;;;OAMG;IACI,KAAK,CAAC,MAAM,CAAC,EAAE,UAAU;IAShC;;;;;;;;;OASG;IACI,KAAK,CACV,KAAK,GAAE,OAAqB,EAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,UAAU;IAUrB;;;;;;;;;OASG;IACI,SAAS,CACd,KAAK,GAAE,OAAqB,EAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,UAAU;IAUrB;;;;;;;;;OASG;IACI,WAAW,CAChB,KAAK,GAAE,OAAqB,EAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,SAAS,EAC5B,MAAM,CAAC,EAAE,UAAU;IAUrB;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,8BAA8B,EACzC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;CAwB3B;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,qCAAqC,iDAK/C,8BAA8B,kBAehC,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../generated-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("../generated-BPiHi7W2.cjs"),u=require("@wagmi/core"),i=require("viem"),d=require("../errors.cjs"),l=require("../utils.cjs"),h=require("./Deployable.cjs"),a=class a extends h.Deployable{constructor(e,s,t){super(e,s),this._isBase=!0,typeof s=="string"&&i.isAddress(s)&&s!==i.zeroAddress&&!Object.values(this.bases).some(r=>!s||!r?!1:i.isAddressEqual(s,r))&&(t=!1),t!==void 0&&(this._isBase=t)}get isBase(){return this.address&&Object.values(this.bases).some(e=>i.isAddressEqual(this.address,e))?!0:this._isBase}get bases(){return this.constructor.bases}get registryType(){return this.constructor.registryType}async deploy(e,s,t){return await super.deploy(e,s,t),this.assertValidAddress(),this}async deployRaw(e,s){if(this.address)throw new d.DeployableAlreadyDeployedError(this.address);const t=e||this._payload,r=(s==null?void 0:s.config)||this._config,{args:y,...o}=this.buildParameters(t);return await u.deployContract(r,{...o,...this.optionallyAttachAccount(s==null?void 0:s.account),args:[]})}async supportsInterface(e,s){return await c.$i(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...s,args:[e]})}async getComponentInterface(e){return await c.ji(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...e,args:[]})}validateDeploymentConfig(e,s){const t=e||this._payload;if(!t)throw new d.DeployableMissingPayloadError;return super.validateDeploymentConfig(t,s)}};a.bases={},a.registryType=l.RegistryType.ACTION;let n=a;exports.DeployableTarget=n;
|
|
2
2
|
//# sourceMappingURL=DeployableTarget.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as d, M as c } from "../generated-CElkFqkY.js";
|
|
2
2
|
import { deployContract as h } from "@wagmi/core";
|
|
3
3
|
import { isAddress as u, zeroAddress as l, isAddressEqual as a } from "viem";
|
|
4
4
|
import { DeployableAlreadyDeployedError as y, DeployableMissingPayloadError as f } from "../errors.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../generated-BPiHi7W2.cjs"),c=require("./DeployableTarget.cjs");var o=(n=>(n[n.MANAGER=1n]="MANAGER",n[n.ADMIN=2n]="ADMIN",n))(o||{});class l extends c.DeployableTarget{async setAuthorized(s,t,a){return await this.awaitResult(this.setAuthorizedRaw(s,t,a))}async setAuthorizedRaw(s,t,a){const{request:i,result:r}=await e.Nk(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a});return{hash:await e.dk(this._config,i),result:r}}async grantRoles(s,t,a){return await this.awaitResult(this.grantRolesRaw(s,t,a))}async grantRolesRaw(s,t,a){const{request:i,result:r}=await e.wk(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a});return{hash:await e.rk(this._config,i),result:r}}async revokeRoles(s,t,a){return await this.awaitResult(this.revokeRolesRaw(s,t,a))}async revokeRolesRaw(s,t,a){const{request:i,result:r}=await e.Ik(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a});return{hash:await e.yk(this._config,i),result:r}}async grantManyRoles(s,t,a){return await this.awaitResult(this.grantManyRolesRaw(s,t,a))}async grantManyRolesRaw(s,t,a){const{request:i,result:r}=await e.vk(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a});return{hash:await e.sk(this._config,i),result:r}}async revokeManyRoles(s,t,a){return await this.awaitResult(this.revokeManyRolesRaw(s,t,a))}async revokeManyRolesRaw(s,t,a){const{request:i,result:r}=await e.hk(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a});return{hash:await e.lk(this._config,i),result:r}}async rolesOf(s,t){const a=await e.tk(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t});return[o.MANAGER,o.ADMIN].filter(i=>(a&i)===i)}hasAnyRole(s,t,a){return e.K0(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a})}hasAllRoles(s,t,a){return e.J0(this._config,{address:this.assertValidAddress(),args:[s,t],...this.optionallyAttachAccount(),...a})}isAuthorized(s,t){return e.X0(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t})}async transferOwnership(s,t){return await this.awaitResult(this.transferOwnershipRaw(s,t))}async transferOwnershipRaw(s,t){const{request:a,result:i}=await e.U1(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t});return{hash:await e.S1(this._config,a),result:i}}async renounceOwnership(s){return await this.awaitResult(this.renounceOwnershipRaw(s))}async renounceOwnershipRaw(s){const{request:t,result:a}=await e.D1(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...s});return{hash:await e.F1(this._config,t),result:a}}async requestOwnershipHandover(s){return await this.awaitResult(this.requestOwnershipHandoverRaw(s))}async requestOwnershipHandoverRaw(s){const{request:t,result:a}=await e.q1(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...s});return{hash:await e.H1(this._config,t),result:a}}async completeOwnershipHandover(s,t){return await this.awaitResult(this.completeOwnershipHandoverRaw(s,t))}async completeOwnershipHandoverRaw(s,t){const{request:a,result:i}=await e._1(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t});return{hash:await e.z1(this._config,a),result:i}}async cancelOwnershipHandover(s){return await this.awaitResult(this.cancelOwnershipHandoverRaw(s))}async cancelOwnershipHandoverRaw(s){const{request:t,result:a}=await e.P1(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...s});return{hash:await e.E1(this._config,t),result:a}}ownershipHandoverExpiresAt(s,t){return e.R1(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t})}async renounceRoles(s,t){return await this.awaitResult(this.renounceRolesRaw(s,t))}async renounceRolesRaw(s,t){const{request:a,result:i}=await e.W1(this._config,{address:this.assertValidAddress(),args:[s],...this.optionallyAttachAccount(),...t});return{hash:await e.V1(this._config,a),result:i}}}exports.rbacAbi=e.V;exports.DeployableTargetWithRBAC=l;exports.Roles=o;
|
|
2
2
|
//# sourceMappingURL=DeployableTargetWithRBAC.cjs.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as o, e as c, w as l,
|
|
2
|
-
import { V as K } from "../generated-
|
|
1
|
+
import { c as o, e as c, w as l, i as d, I as u, j as w, v as A, s as R, k as y, l as g, t as p, K as f, J as _, X as v, U as k, n as V, D as q, F as O, q as M, o as H, u as m, x as D, P as N, E, C as x, W as z, G as I } from "../generated-CElkFqkY.js";
|
|
2
|
+
import { V as K } from "../generated-CElkFqkY.js";
|
|
3
3
|
import { DeployableTarget as b } from "./DeployableTarget.js";
|
|
4
4
|
var h = /* @__PURE__ */ ((r) => (r[r.MANAGER = 1n] = "MANAGER", r[r.ADMIN = 2n] = "ADMIN", r))(h || {});
|
|
5
5
|
class C extends b {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { f as C,
|
|
2
|
-
import {
|
|
1
|
+
import { f as C, bW as x, bX as P, bY as $, bZ as B, b_ as k, b$ as F, c0 as q, c1 as G, c2 as L, c3 as M, c4 as U, c5 as j, c6 as z, c7 as O, c8 as S, y as v, c9 as W, ca as X, cb as Y, cc as H, cd as Q, ce as Z, cf as J, cg as K, ch as f0, ci as a0, cj as b0, ck as e0, cl as d0, cm as c0, cn as t0, co as s0, cp as i0, cq as r0 } from "./generated-CElkFqkY.js";
|
|
2
|
+
import { g as n0, h as o0, i as l0, j as m0, k as u0, l as g0, m as h0, n as y0 } from "./componentInterfaces-5Ezh3Pvx.js";
|
|
3
3
|
import { getTransactionReceipt as p0, getTransaction as w0, readContract as A0 } from "@wagmi/core";
|
|
4
|
-
import { NoMatchingLogsError as I, DecodedArgsError as
|
|
4
|
+
import { NoMatchingLogsError as I, DecodedArgsError as u, InvalidCriteriaTypeError as C0, IncentiveCriteriaNotFoundError as v0, InvalidComponentInterfaceError as I0 } from "./errors.js";
|
|
5
5
|
import { AllowListIncentive as V0 } from "./Incentives/AllowListIncentive.js";
|
|
6
6
|
import { CGDAIncentive as R0 } from "./Incentives/CGDAIncentive.js";
|
|
7
7
|
import { ERC20Incentive as _0 } from "./Incentives/ERC20Incentive.js";
|
|
8
8
|
import { encodeAbiParameters as l, zeroAddress as t, decodeAbiParameters as o, parseEventLogs as D0, decodeFunctionData as N0, parseEther as V } from "viem";
|
|
9
|
-
import { g as E0, h as T0 } from "./deployments-
|
|
9
|
+
import { g as E0, h as T0 } from "./deployments-3RHH-eW7.js";
|
|
10
10
|
import { DeployableTarget as E } from "./Deployable/DeployableTarget.js";
|
|
11
11
|
import { prepareClaimPayload as g } from "./claiming.js";
|
|
12
12
|
import { RegistryType as T, CheatCodes as x0 } from "./utils.js";
|
|
@@ -123,7 +123,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
123
123
|
* @returns {Promise<Address>}
|
|
124
124
|
*/
|
|
125
125
|
async peg(f) {
|
|
126
|
-
return await
|
|
126
|
+
return await q(this._config, {
|
|
127
127
|
address: this.assertValidAddress(),
|
|
128
128
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
129
129
|
...f
|
|
@@ -138,7 +138,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
138
138
|
* @returns {Promise<bigint>}
|
|
139
139
|
*/
|
|
140
140
|
async reward(f) {
|
|
141
|
-
return await
|
|
141
|
+
return await G(this._config, {
|
|
142
142
|
address: this.assertValidAddress(),
|
|
143
143
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
144
144
|
...f
|
|
@@ -153,7 +153,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
153
153
|
* @returns {Promise<bigint>}
|
|
154
154
|
*/
|
|
155
155
|
async limit(f) {
|
|
156
|
-
return await
|
|
156
|
+
return await L(this._config, {
|
|
157
157
|
address: this.assertValidAddress(),
|
|
158
158
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
159
159
|
...f
|
|
@@ -215,7 +215,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
215
215
|
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
|
|
216
216
|
*/
|
|
217
217
|
async clawbackRaw(f, a) {
|
|
218
|
-
const { request: b, result: e } = await
|
|
218
|
+
const { request: b, result: e } = await j(
|
|
219
219
|
this._config,
|
|
220
220
|
{
|
|
221
221
|
address: this.assertValidAddress(),
|
|
@@ -225,7 +225,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
225
225
|
...a
|
|
226
226
|
}
|
|
227
227
|
);
|
|
228
|
-
return { hash: await
|
|
228
|
+
return { hash: await z(this._config, b), result: e };
|
|
229
229
|
}
|
|
230
230
|
/**
|
|
231
231
|
* Check if an incentive is claimable.
|
|
@@ -237,7 +237,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
237
237
|
* @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload
|
|
238
238
|
*/
|
|
239
239
|
async isClaimable(f, a) {
|
|
240
|
-
return await
|
|
240
|
+
return await O(this._config, {
|
|
241
241
|
address: this.assertValidAddress(),
|
|
242
242
|
args: [f.target, f.data],
|
|
243
243
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -253,7 +253,7 @@ const k0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
253
253
|
* @returns {Promise<Address>} = The address of the token the reward is pegged to
|
|
254
254
|
*/
|
|
255
255
|
async getPeg(f) {
|
|
256
|
-
return await
|
|
256
|
+
return await S(this._config, {
|
|
257
257
|
address: this.assertValidAddress(),
|
|
258
258
|
args: [],
|
|
259
259
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -424,7 +424,7 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
424
424
|
* @returns {Promise<Address>}
|
|
425
425
|
*/
|
|
426
426
|
async owner(f) {
|
|
427
|
-
return await
|
|
427
|
+
return await W(this._config, {
|
|
428
428
|
address: this.assertValidAddress(),
|
|
429
429
|
args: [],
|
|
430
430
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -440,7 +440,7 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
440
440
|
* @returns {Promise<bigint>} - The current reward
|
|
441
441
|
*/
|
|
442
442
|
async currentReward(f) {
|
|
443
|
-
return await
|
|
443
|
+
return await X(
|
|
444
444
|
this._config,
|
|
445
445
|
{
|
|
446
446
|
address: this.assertValidAddress(),
|
|
@@ -459,7 +459,7 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
459
459
|
* @returns {Promise<bigint>} The maximum reward amount per claim
|
|
460
460
|
*/
|
|
461
461
|
async getMaxReward(f) {
|
|
462
|
-
return await
|
|
462
|
+
return await Y(this._config, {
|
|
463
463
|
...f,
|
|
464
464
|
address: this.assertValidAddress()
|
|
465
465
|
});
|
|
@@ -489,8 +489,8 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
489
489
|
`No logs found for event signature ${d.signature}`
|
|
490
490
|
);
|
|
491
491
|
try {
|
|
492
|
-
const
|
|
493
|
-
abi: [
|
|
492
|
+
const m = b[d.signature], i = D0({
|
|
493
|
+
abi: [m],
|
|
494
494
|
logs: n
|
|
495
495
|
});
|
|
496
496
|
if (i == null || i.length === 0)
|
|
@@ -499,13 +499,13 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
499
499
|
);
|
|
500
500
|
const A = ((c = i[0]) == null ? void 0 : c.args)[d.fieldIndex];
|
|
501
501
|
if (A === void 0)
|
|
502
|
-
throw new
|
|
502
|
+
throw new u(
|
|
503
503
|
`Decoded argument at index ${d.fieldIndex} is undefined`
|
|
504
504
|
);
|
|
505
505
|
return BigInt(A);
|
|
506
|
-
} catch (
|
|
507
|
-
throw new
|
|
508
|
-
`Failed to decode event log for signature ${d.signature}: ${
|
|
506
|
+
} catch (m) {
|
|
507
|
+
throw new u(
|
|
508
|
+
`Failed to decode event log for signature ${d.signature}: ${m.message}`
|
|
509
509
|
);
|
|
510
510
|
}
|
|
511
511
|
} else if (d.criteriaType === R.FUNC) {
|
|
@@ -519,12 +519,12 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
519
519
|
data: s.input
|
|
520
520
|
}).args[d.fieldIndex];
|
|
521
521
|
if (i == null)
|
|
522
|
-
throw new
|
|
522
|
+
throw new u(
|
|
523
523
|
`Decoded argument at index ${d.fieldIndex} is undefined`
|
|
524
524
|
);
|
|
525
525
|
return BigInt(i);
|
|
526
526
|
} catch (n) {
|
|
527
|
-
throw new
|
|
527
|
+
throw new u(
|
|
528
528
|
`Failed to decode function data for signature ${d.signature}: ${n.message}`
|
|
529
529
|
);
|
|
530
530
|
}
|
|
@@ -542,7 +542,7 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
542
542
|
* @returns {Promise<bigint>}
|
|
543
543
|
*/
|
|
544
544
|
async claims(f) {
|
|
545
|
-
return await
|
|
545
|
+
return await H(this._config, {
|
|
546
546
|
address: this.assertValidAddress(),
|
|
547
547
|
args: [],
|
|
548
548
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -558,7 +558,7 @@ const F0 = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd1980
|
|
|
558
558
|
* @returns {Promise<bigint>}
|
|
559
559
|
*/
|
|
560
560
|
async totalClaimed(f) {
|
|
561
|
-
return await
|
|
561
|
+
return await Q(
|
|
562
562
|
this._config,
|
|
563
563
|
{
|
|
564
564
|
address: this.assertValidAddress(),
|
|
@@ -1004,8 +1004,8 @@ const N = {
|
|
|
1004
1004
|
[n0]: B0,
|
|
1005
1005
|
[o0]: _0,
|
|
1006
1006
|
[l0]: w,
|
|
1007
|
-
[
|
|
1008
|
-
[
|
|
1007
|
+
[m0]: p,
|
|
1008
|
+
[u0]: V0,
|
|
1009
1009
|
// [AERC1155Incentive as Hex]: ERC1155Incentive,
|
|
1010
1010
|
[g0]: R0,
|
|
1011
1011
|
[h0]: $0,
|
|
@@ -1033,4 +1033,4 @@ export {
|
|
|
1033
1033
|
K0 as i,
|
|
1034
1034
|
_ as p
|
|
1035
1035
|
};
|
|
1036
|
-
//# sourceMappingURL=Incentive-
|
|
1036
|
+
//# sourceMappingURL=Incentive-DZLG6T1-.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Incentive-Boviez4z.js","sources":["../src/Incentives/ERC20PeggedIncentive.ts","../src/Incentives/ERC20PeggedVariableCriteriaIncentive.ts","../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20PeggedIncentiveAbi,\n readErc20PeggedIncentiveAsset,\n readErc20PeggedIncentiveClaimed,\n readErc20PeggedIncentiveClaims,\n readErc20PeggedIncentiveCurrentReward,\n readErc20PeggedIncentiveGetPeg,\n readErc20PeggedIncentiveIsClaimable,\n readErc20PeggedIncentiveLimit,\n readErc20PeggedIncentiveOwner,\n readErc20PeggedIncentivePeg,\n readErc20PeggedIncentiveReward,\n readErc20PeggedIncentiveTotalClaimed,\n simulateErc20PeggedIncentiveClaim,\n simulateErc20PeggedIncentiveClawback,\n writeErc20PeggedIncentiveClaim,\n writeErc20PeggedIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedIncentive.sol/ERC20PeggedIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n encodeAbiParameters,\n zeroAddress,\n} from 'viem';\nimport { ERC20PeggedIncentive as ERC20PeggedIncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20PeggedIncentiveAbi };\n\n/**\n * The object representation of a `ERC20PeggedIncentive.InitPayload`\n *\n * @export\n * @interface ERC20PeggedIncentivePayload\n * @typedef {ERC20PeggedIncentivePayload}\n */\nexport interface ERC20PeggedIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20PeggedIncentive` event types.\n *\n * @export\n * @typedef {ERC20PeggedIncentiveLog}\n * @template {ContractEventName<typeof erc20PeggedIncentiveAbi>} [event=ContractEventName<\n * typeof erc20PeggedIncentiveAbi\n * >]\n */\nexport type ERC20PeggedIncentiveLog<\n event extends ContractEventName<\n typeof erc20PeggedIncentiveAbi\n > = ContractEventName<typeof erc20PeggedIncentiveAbi>,\n> = GenericLog<typeof erc20PeggedIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20PeggedIncentive\n * @typedef {ERC20PeggedIncentive}\n * @extends {DeployableTarget<ERC20PeggedIncentivePayload>}\n */\nexport class ERC20PeggedIncentive extends DeployableTarget<\n ERC20PeggedIncentivePayload,\n typeof erc20PeggedIncentiveAbi\n> {\n public override readonly abi = erc20PeggedIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20PeggedIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedIncentiveTotalClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedIncentivePeg(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20PeggedIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20PeggedIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedIncentiveGetPeg(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedIncentive.\n *\n * @public\n * @param {bigint} rewardAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedIncentive.\n */\n public buildClaimData(rewardAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'rewardAmount' }],\n [rewardAmount],\n );\n }\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedIncentivePayload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n manager: this.payload?.manager ?? zeroAddress,\n });\n }\n\n /**\n * Decodes claim data for the ERC20PeggedIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n return signedAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedIncentivePayload}, properly encode a `ERC20PeggedIncentive.InitPayload` for use with {@link ERC20PeggedIncentive} initialization.\n *\n * @param {ERC20PeggedIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedIncentivePayload({\n asset,\n peg,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20PeggedIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [asset, peg, reward, limit, manager],\n );\n}\n","import {\n erc20PeggedVariableCriteriaIncentiveAbi,\n readErc20PeggedVariableCriteriaIncentiveAsset,\n readErc20PeggedVariableCriteriaIncentiveClaimed,\n readErc20PeggedVariableCriteriaIncentiveClaims,\n readErc20PeggedVariableCriteriaIncentiveCurrentReward,\n readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20PeggedVariableCriteriaIncentiveGetMaxReward,\n readErc20PeggedVariableCriteriaIncentiveGetPeg,\n readErc20PeggedVariableCriteriaIncentiveIsClaimable,\n readErc20PeggedVariableCriteriaIncentiveLimit,\n readErc20PeggedVariableCriteriaIncentiveOwner,\n readErc20PeggedVariableCriteriaIncentivePeg,\n readErc20PeggedVariableCriteriaIncentiveReward,\n readErc20PeggedVariableCriteriaIncentiveTotalClaimed,\n simulateErc20PeggedVariableCriteriaIncentiveClaim,\n simulateErc20PeggedVariableCriteriaIncentiveClawback,\n writeErc20PeggedVariableCriteriaIncentiveClaim,\n writeErc20PeggedVariableCriteriaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedVariableCriteriaIncentive.sol/ERC20PeggedVariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport type { AbiEvent } from 'abitype';\nimport {\n type AbiFunction,\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n} from 'viem';\nimport { ERC20PeggedVariableCriteriaIncentive as ERC20PeggedVariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport {\n CheatCodes,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\nimport type {\n GetIncentiveScalarParams,\n IncentiveCriteria,\n} from './ERC20VariableCriteriaIncentive';\n\nexport { erc20PeggedVariableCriteriaIncentiveAbi };\n\n/**\n * The object representation of a `Erc20PeggedVariableCriteriaIncentive.InitPayload`\n *\n * @export\n * @interface Erc20PeggedVariableCriteriaIncentive\n * @typedef {Erc20PeggedVariableCriteriaIncentive}\n */\nexport interface ERC20PeggedVariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * Maximum reward each claim is elligible for.\n *\n * @type {bigint}\n */\n maxReward: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\n/**\n * A generic `viem.Log` event with support for `Erc20PeggedVariableCriteriaIncentive` event types.\n *\n * @export\n * @typedef {Erc20PeggedVariableCriteriaIncentiveLog}\n * @template {ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveAbi>} [event=ContractEventName<\n * typeof erc20PeggedVariableCriteriaIncentiveAbi\n * >]\n */\nexport type Erc20PeggedVariableCriteriaIncentiveLog<\n event extends ContractEventName<\n typeof erc20PeggedVariableCriteriaIncentiveAbi\n > = ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveAbi>,\n> = GenericLog<typeof erc20PeggedVariableCriteriaIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class Erc20PeggedVariableCriteriaIncentive\n * @typedef {ERC20PeggedVariableCriteriaIncentive}\n * @extends {DeployableTarget<ERC20PeggedVariableCriteriaIncentive>}\n */\nexport class ERC20PeggedVariableCriteriaIncentive extends DeployableTarget<\n ERC20PeggedVariableCriteriaIncentivePayload,\n typeof erc20PeggedVariableCriteriaIncentiveAbi\n> {\n public override readonly abi = erc20PeggedVariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20PeggedVariableCriteriaIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveCurrentReward(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * Retrieves the maximum reward amount per claim.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} The maximum reward amount per claim\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward =\n await readErc20PeggedVariableCriteriaIncentiveGetMaxReward(this._config, {\n ...params,\n address: this.assertValidAddress(),\n });\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveTotalClaimed(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentivePeg(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveClaim(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 writeErc20PeggedVariableCriteriaIncentiveClaim(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveClawback(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 writeErc20PeggedVariableCriteriaIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveIsClaimable(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveGetPeg(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedVariableCriteriaIncentivePayload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n maxReward: this.payload?.maxReward ?? 0n,\n manager: this.payload?.manager ?? zeroAddress,\n criteria: this.payload?.criteria ?? {\n criteriaType: 0,\n signature: zeroAddress,\n fieldIndex: 0,\n targetContract: zeroAddress,\n },\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedVariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedVariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedVariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedVariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n *\n * @public\n * @param {bigint} signedAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n */\n public buildClaimData(signedAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'signedAmount' }],\n [signedAmount],\n );\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n * Use this function instead of `decodeClaimData` if you have reward details.\n *\n * @public\n * @param {Hex} claimData\n * @param {bigint} [reward]\n * @param {bigint} [maxReward]\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimDataWithRewardDetails(\n claimData: Hex,\n reward: bigint,\n maxReward: bigint,\n ) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedVariableCriteriaIncentivePayload}, properly encode a `ERC20PeggedVariableCriteriaIncentivePayload.InitPayload` for use with {@link ERC20PeggedVariableCriteriaIncentivePayload} initialization.\n *\n * @param {ERC20PeggedVariableCriteriaIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedVariableCriteriaIncentivePayload({\n asset,\n peg,\n reward,\n limit,\n maxReward = 0n,\n manager = zeroAddress,\n criteria,\n}: ERC20PeggedVariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset,\n peg,\n reward,\n limit,\n manager,\n maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20PeggedIncentive,\n AERC20PeggedVariableCriteriaIncentive,\n AERC20VariableCriteriaIncentive,\n AERC20VariableIncentive,\n // AERC20VariableCriteriaIncentive\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport type { ReadParams } from '../utils';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20PeggedIncentive } from './ERC20PeggedIncentive';\nimport { ERC20PeggedVariableCriteriaIncentive } from './ERC20PeggedVariableCriteriaIncentive';\nimport { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n ERC20PeggedIncentive,\n ERC20PeggedVariableCriteriaIncentive,\n PointsIncentive,\n ERC20VariableIncentive,\n ERC20VariableCriteriaIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | ERC20PeggedIncentive\n | ERC20PeggedVariableCriteriaIncentive\n | PointsIncentive\n | ERC20VariableIncentive\n | ERC20VariableCriteriaIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x4414fbb4\": typeof ERC20PeggedIncentive; \"0xf60c99c9\": typeof ERC20PeggedVariableCriteriaIncentive; \"0x56586338\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0xa8e4af1e\": typeof ERC20VariableIncentive; \"0x90318111\": typeof ERC20VariableCriteriaIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n [AERC20PeggedVariableCriteriaIncentive as Hex]:\n ERC20PeggedVariableCriteriaIncentive,\n [AERC20PeggedIncentive as Hex]: ERC20PeggedIncentive,\n [AAllowListIncentive]: AllowListIncentive,\n // [AERC1155Incentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n [AERC20VariableCriteriaIncentive as Hex]: ERC20VariableCriteriaIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Incentive}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n params?: ReadParams,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n ...params,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20PeggedIncentive","DeployableTarget","erc20PeggedIncentiveAbi","params","readErc20PeggedIncentiveOwner","readErc20PeggedIncentiveCurrentReward","readErc20PeggedIncentiveClaims","readErc20PeggedIncentiveTotalClaimed","address","readErc20PeggedIncentiveClaimed","readErc20PeggedIncentiveAsset","readErc20PeggedIncentivePeg","readErc20PeggedIncentiveReward","readErc20PeggedIncentiveLimit","payload","request","result","simulateErc20PeggedIncentiveClaim","prepareClaimPayload","writeErc20PeggedIncentiveClaim","simulateErc20PeggedIncentiveClawback","writeErc20PeggedIncentiveClawback","readErc20PeggedIncentiveIsClaimable","readErc20PeggedIncentiveGetPeg","totalClaimed","limit","_payload","_options","options","bytecode","prepareERC20PeggedIncentivePayload","amount","encodeAbiParameters","rewardAmount","netAmount","zeroAddress","_a","_b","_c","claimData","boostClaimData","decodeAbiParameters","ERC20PeggedIncentiveBases","RegistryType","ERC20PeggedIncentive","asset","peg","reward","manager","_ERC20PeggedVariableCriteriaIncentive","erc20PeggedVariableCriteriaIncentiveAbi","readErc20PeggedVariableCriteriaIncentiveOwner","readErc20PeggedVariableCriteriaIncentiveCurrentReward","readErc20PeggedVariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","DecodedArgsError","e","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","readErc20PeggedVariableCriteriaIncentiveClaims","readErc20PeggedVariableCriteriaIncentiveTotalClaimed","readErc20PeggedVariableCriteriaIncentiveClaimed","readErc20PeggedVariableCriteriaIncentiveAsset","readErc20PeggedVariableCriteriaIncentivePeg","readErc20PeggedVariableCriteriaIncentiveReward","readErc20PeggedVariableCriteriaIncentiveLimit","simulateErc20PeggedVariableCriteriaIncentiveClaim","writeErc20PeggedVariableCriteriaIncentiveClaim","simulateErc20PeggedVariableCriteriaIncentiveClawback","writeErc20PeggedVariableCriteriaIncentiveClawback","readErc20PeggedVariableCriteriaIncentiveIsClaimable","readErc20PeggedVariableCriteriaIncentiveGetPeg","readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria","IncentiveCriteriaNotFoundError","prepareERC20PeggedVariableCriteriaIncentivePayload","_d","_e","signedAmount","claimAmount","maxReward","parseEther","ERC20PeggedVariableCriteriaIncentiveBases","ERC20PeggedVariableCriteriaIncentive","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AERC20PeggedVariableCriteriaIncentive","AERC20PeggedIncentive","AAllowListIncentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","ERC20VariableIncentive","AERC20VariableCriteriaIncentive","ERC20VariableCriteriaIncentive","incentiveFromAddress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;AAYsB,eAAAC,GACpBtF,GACApB,GACAL,GACA;AACA,QAAMgH,IAAe,MAAMC,GAAaxF,EAAQ,QAAQ;AAAA,IACtD,KAAKyF;AAAAA,IACL,cAAc;AAAA,IACd,SAAA7G;AAAA,IACA,GAAGL;AAAA,EAAA,CACJ,GACKmH,IAAOnB,EAA8BgB,CAAW;AACtD,MAAI,CAACG;AACH,UAAM,IAAIC;AAAA,MACR,OAAO,KAAKpB,CAA6B;AAAA,MACzCgB;AAAA,IAAA;AAGG,SAAA,IAAIG,EAAK1F,GAASpB,CAAO;AAClC;"}
|
|
1
|
+
{"version":3,"file":"Incentive-DZLG6T1-.js","sources":["../src/Incentives/ERC20PeggedIncentive.ts","../src/Incentives/ERC20PeggedVariableCriteriaIncentive.ts","../src/Incentives/Incentive.ts"],"sourcesContent":["import {\n erc20PeggedIncentiveAbi,\n readErc20PeggedIncentiveAsset,\n readErc20PeggedIncentiveClaimed,\n readErc20PeggedIncentiveClaims,\n readErc20PeggedIncentiveCurrentReward,\n readErc20PeggedIncentiveGetPeg,\n readErc20PeggedIncentiveIsClaimable,\n readErc20PeggedIncentiveLimit,\n readErc20PeggedIncentiveOwner,\n readErc20PeggedIncentivePeg,\n readErc20PeggedIncentiveReward,\n readErc20PeggedIncentiveTotalClaimed,\n simulateErc20PeggedIncentiveClaim,\n simulateErc20PeggedIncentiveClawback,\n writeErc20PeggedIncentiveClaim,\n writeErc20PeggedIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedIncentive.sol/ERC20PeggedIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n encodeAbiParameters,\n zeroAddress,\n} from 'viem';\nimport { ERC20PeggedIncentive as ERC20PeggedIncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20PeggedIncentiveAbi };\n\n/**\n * The object representation of a `ERC20PeggedIncentive.InitPayload`\n *\n * @export\n * @interface ERC20PeggedIncentivePayload\n * @typedef {ERC20PeggedIncentivePayload}\n */\nexport interface ERC20PeggedIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20PeggedIncentive` event types.\n *\n * @export\n * @typedef {ERC20PeggedIncentiveLog}\n * @template {ContractEventName<typeof erc20PeggedIncentiveAbi>} [event=ContractEventName<\n * typeof erc20PeggedIncentiveAbi\n * >]\n */\nexport type ERC20PeggedIncentiveLog<\n event extends ContractEventName<\n typeof erc20PeggedIncentiveAbi\n > = ContractEventName<typeof erc20PeggedIncentiveAbi>,\n> = GenericLog<typeof erc20PeggedIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20PeggedIncentive\n * @typedef {ERC20PeggedIncentive}\n * @extends {DeployableTarget<ERC20PeggedIncentivePayload>}\n */\nexport class ERC20PeggedIncentive extends DeployableTarget<\n ERC20PeggedIncentivePayload,\n typeof erc20PeggedIncentiveAbi\n> {\n public override readonly abi = erc20PeggedIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20PeggedIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedIncentiveTotalClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedIncentivePeg(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20PeggedIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20PeggedIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20PeggedIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedIncentiveGetPeg(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedIncentive.\n *\n * @public\n * @param {bigint} rewardAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedIncentive.\n */\n public buildClaimData(rewardAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'rewardAmount' }],\n [rewardAmount],\n );\n }\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedIncentivePayload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n manager: this.payload?.manager ?? zeroAddress,\n });\n }\n\n /**\n * Decodes claim data for the ERC20PeggedIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n return signedAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedIncentivePayload}, properly encode a `ERC20PeggedIncentive.InitPayload` for use with {@link ERC20PeggedIncentive} initialization.\n *\n * @param {ERC20PeggedIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedIncentivePayload({\n asset,\n peg,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20PeggedIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [asset, peg, reward, limit, manager],\n );\n}\n","import {\n erc20PeggedVariableCriteriaIncentiveAbi,\n readErc20PeggedVariableCriteriaIncentiveAsset,\n readErc20PeggedVariableCriteriaIncentiveClaimed,\n readErc20PeggedVariableCriteriaIncentiveClaims,\n readErc20PeggedVariableCriteriaIncentiveCurrentReward,\n readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20PeggedVariableCriteriaIncentiveGetMaxReward,\n readErc20PeggedVariableCriteriaIncentiveGetPeg,\n readErc20PeggedVariableCriteriaIncentiveIsClaimable,\n readErc20PeggedVariableCriteriaIncentiveLimit,\n readErc20PeggedVariableCriteriaIncentiveOwner,\n readErc20PeggedVariableCriteriaIncentivePeg,\n readErc20PeggedVariableCriteriaIncentiveReward,\n readErc20PeggedVariableCriteriaIncentiveTotalClaimed,\n simulateErc20PeggedVariableCriteriaIncentiveClaim,\n simulateErc20PeggedVariableCriteriaIncentiveClawback,\n writeErc20PeggedVariableCriteriaIncentiveClaim,\n writeErc20PeggedVariableCriteriaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20PeggedVariableCriteriaIncentive.sol/ERC20PeggedVariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport type { AbiEvent } from 'abitype';\nimport {\n type AbiFunction,\n type Address,\n type ContractEventName,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n} from 'viem';\nimport { ERC20PeggedVariableCriteriaIncentive as ERC20PeggedVariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport { type ClaimPayload, prepareClaimPayload } from '../claiming';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport {\n CheatCodes,\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\nimport type {\n GetIncentiveScalarParams,\n IncentiveCriteria,\n} from './ERC20VariableCriteriaIncentive';\n\nexport { erc20PeggedVariableCriteriaIncentiveAbi };\n\n/**\n * The object representation of a `Erc20PeggedVariableCriteriaIncentive.InitPayload`\n *\n * @export\n * @interface Erc20PeggedVariableCriteriaIncentive\n * @typedef {Erc20PeggedVariableCriteriaIncentive}\n */\nexport interface ERC20PeggedVariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The peg to normalize to.\n *\n * @type {Address}\n */\n peg: Address;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * Total spend for the incentive.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * Maximum reward each claim is elligible for.\n *\n * @type {bigint}\n */\n maxReward: bigint;\n /**\n * (Optional) The address of the entity that can managed the incentive.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\n/**\n * A generic `viem.Log` event with support for `Erc20PeggedVariableCriteriaIncentive` event types.\n *\n * @export\n * @typedef {Erc20PeggedVariableCriteriaIncentiveLog}\n * @template {ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveAbi>} [event=ContractEventName<\n * typeof erc20PeggedVariableCriteriaIncentiveAbi\n * >]\n */\nexport type Erc20PeggedVariableCriteriaIncentiveLog<\n event extends ContractEventName<\n typeof erc20PeggedVariableCriteriaIncentiveAbi\n > = ContractEventName<typeof erc20PeggedVariableCriteriaIncentiveAbi>,\n> = GenericLog<typeof erc20PeggedVariableCriteriaIncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class Erc20PeggedVariableCriteriaIncentive\n * @typedef {ERC20PeggedVariableCriteriaIncentive}\n * @extends {DeployableTarget<ERC20PeggedVariableCriteriaIncentive>}\n */\nexport class ERC20PeggedVariableCriteriaIncentive extends DeployableTarget<\n ERC20PeggedVariableCriteriaIncentivePayload,\n typeof erc20PeggedVariableCriteriaIncentiveAbi\n> {\n public override readonly abi = erc20PeggedVariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20PeggedVariableCriteriaIncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveCurrentReward(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * Retrieves the maximum reward amount per claim.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} The maximum reward amount per claim\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward =\n await readErc20PeggedVariableCriteriaIncentiveGetMaxReward(this._config, {\n ...params,\n address: this.assertValidAddress(),\n });\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The total amount of rewards claimed\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalClaimed(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveTotalClaimed(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the pegged ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async peg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentivePeg(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max possible rewards payout in reward token)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveClaim(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 writeErc20PeggedVariableCriteriaIncentiveClaim(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } =\n await simulateErc20PeggedVariableCriteriaIncentiveClawback(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 writeErc20PeggedVariableCriteriaIncentiveClawback(\n this._config,\n request,\n );\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveIsClaimable(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [payload.target, payload.data],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n }\n\n /**\n * read the peg token for the incentive.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>} = The address of the token the reward is pegged to\n */\n public async getPeg(params?: ReadParams) {\n return await readErc20PeggedVariableCriteriaIncentiveGetPeg(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n return await this.limit(params);\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [totalClaimed, limit] = await Promise.all([\n this.totalClaimed(params),\n this.limit(params),\n ]);\n return limit - totalClaimed;\n }\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Generates a top-up payload for the ERC20PeggedIncentive contract by incrementing\n * the existing `limit` field by `netAmount`. The entire payload is then re-encoded\n * via `prepareERC20PeggedIncentivePayload(...)`.\n *\n * @public\n * @param {bigint} netAmount - The additional limit to add to this incentive.\n * @returns {Hex} The ABI-encoded payload with the updated `limit`.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return prepareERC20PeggedVariableCriteriaIncentivePayload({\n asset: (await this.asset()) ?? zeroAddress,\n peg: this.payload?.peg ?? zeroAddress,\n reward: this.payload?.reward ?? 0n,\n limit: netAmount,\n maxReward: this.payload?.maxReward ?? 0n,\n manager: this.payload?.manager ?? zeroAddress,\n criteria: this.payload?.criteria ?? {\n criteriaType: 0,\n signature: zeroAddress,\n fieldIndex: 0,\n targetContract: zeroAddress,\n },\n });\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20PeggedVariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20PeggedVariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20PeggedVariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20PeggedVariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n *\n * @public\n * @param {bigint} signedAmount\n * @returns {Hash} Returns the encoded claim data\n * @description This function returns the encoded claim data for the ERC20PeggedVariableCriteriaIncentivePayload.\n */\n public buildClaimData(signedAmount: bigint) {\n return encodeAbiParameters(\n [{ type: 'uint256', name: 'signedAmount' }],\n [signedAmount],\n );\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Decodes claim data for the ERC20PeggedVariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n * Use this function instead of `decodeClaimData` if you have reward details.\n *\n * @public\n * @param {Hex} claimData\n * @param {bigint} [reward]\n * @param {bigint} [maxReward]\n * @returns {BigInt} Returns the reward amount from a claim data payload\n */\n public decodeClaimDataWithRewardDetails(\n claimData: Hex,\n reward: bigint,\n maxReward: bigint,\n ) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n}\n\n/**\n * Given a {@link ERC20PeggedVariableCriteriaIncentivePayload}, properly encode a `ERC20PeggedVariableCriteriaIncentivePayload.InitPayload` for use with {@link ERC20PeggedVariableCriteriaIncentivePayload} initialization.\n *\n * @param {ERC20PeggedVariableCriteriaIncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {Address} param0.peg - The peg to normalize to.\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can manage the incentive.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20PeggedVariableCriteriaIncentivePayload({\n asset,\n peg,\n reward,\n limit,\n maxReward = 0n,\n manager = zeroAddress,\n criteria,\n}: ERC20PeggedVariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'address', name: 'peg' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset,\n peg,\n reward,\n limit,\n manager,\n maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n","import { aIncentiveAbi } from '@boostxyz/evm';\nimport {\n AAllowListIncentive,\n ACGDAIncentive,\n AERC20Incentive,\n AERC20PeggedIncentive,\n AERC20PeggedVariableCriteriaIncentive,\n AERC20VariableCriteriaIncentive,\n AERC20VariableIncentive,\n // AERC20VariableCriteriaIncentive\n APointsIncentive,\n} from '@boostxyz/evm/deploys/componentInterfaces.json';\nimport { readContract } from '@wagmi/core';\nimport type { Address, Hex } from 'viem';\nimport type { DeployableOptions } from '../Deployable/Deployable';\nimport { InvalidComponentInterfaceError } from '../errors';\nimport type { ReadParams } from '../utils';\nimport { AllowListIncentive } from './AllowListIncentive';\nimport { CGDAIncentive } from './CGDAIncentive';\nimport { ERC20Incentive } from './ERC20Incentive';\nimport { ERC20PeggedIncentive } from './ERC20PeggedIncentive';\nimport { ERC20PeggedVariableCriteriaIncentive } from './ERC20PeggedVariableCriteriaIncentive';\nimport { ERC20VariableCriteriaIncentive } from './ERC20VariableCriteriaIncentive';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n// import { ERC1155Incentive } from './ERC1155Incentive';\nimport { PointsIncentive } from './PointsIncentive';\n\nexport {\n AllowListIncentive,\n CGDAIncentive,\n // ERC1155Incentive,\n ERC20Incentive,\n ERC20PeggedIncentive,\n ERC20PeggedVariableCriteriaIncentive,\n PointsIncentive,\n ERC20VariableIncentive,\n ERC20VariableCriteriaIncentive,\n};\n\n/**\n * A union type representing all valid protocol Incentive implementations\n *\n * @export\n * @typedef {Incentive}\n */\nexport type Incentive =\n | AllowListIncentive\n | CGDAIncentive\n | ERC20Incentive\n // | ERC1155Incentive\n | ERC20PeggedIncentive\n | ERC20PeggedVariableCriteriaIncentive\n | PointsIncentive\n | ERC20VariableIncentive\n | ERC20VariableCriteriaIncentive;\n\n/**\n * A map of Incentive component interfaces to their constructors.\n *\n * @type {{ \"0xc5b24b8e\": typeof PointsIncentive; \"0x8c901437\": typeof ERC20Incentive; \"0x4414fbb4\": typeof ERC20PeggedIncentive; \"0xf60c99c9\": typeof ERC20PeggedVariableCriteriaIncentive; \"0x56586338\": typeof AllowListIncentive; \"0xa39e44d9\": typeof CGDAIncentive; \"0xa8e4af1e\": typeof ERC20VariableIncentive; \"0x90318111\": typeof ERC20VariableCriteriaIncentive }}\n */\nexport const IncentiveByComponentInterface = {\n [APointsIncentive as Hex]: PointsIncentive,\n [AERC20Incentive as Hex]: ERC20Incentive,\n [AERC20PeggedVariableCriteriaIncentive as Hex]:\n ERC20PeggedVariableCriteriaIncentive,\n [AERC20PeggedIncentive as Hex]: ERC20PeggedIncentive,\n [AAllowListIncentive]: AllowListIncentive,\n // [AERC1155Incentive as Hex]: ERC1155Incentive,\n [ACGDAIncentive as Hex]: CGDAIncentive,\n [AERC20VariableIncentive as Hex]: ERC20VariableIncentive,\n [AERC20VariableCriteriaIncentive as Hex]: ERC20VariableCriteriaIncentive,\n};\n\n/**\n * A function that will read a contract's component interface using `getComponentInterface` and return the correct instantiated instance.\n *\n * @export\n * @async\n * @param {DeployableOptions} options\n * @param {Address} address\n * @returns {Incentive}\n * @throws {@link InvalidComponentInterfaceError}\n */\nexport async function incentiveFromAddress(\n options: DeployableOptions,\n address: Address,\n params?: ReadParams,\n) {\n const interfaceId = (await readContract(options.config, {\n abi: aIncentiveAbi,\n functionName: 'getComponentInterface',\n address,\n ...params,\n })) as keyof typeof IncentiveByComponentInterface;\n const Ctor = IncentiveByComponentInterface[interfaceId];\n if (!Ctor) {\n throw new InvalidComponentInterfaceError(\n Object.keys(IncentiveByComponentInterface) as Hex[],\n interfaceId as Hex,\n );\n }\n return new Ctor(options, address);\n}\n"],"names":["_ERC20PeggedIncentive","DeployableTarget","erc20PeggedIncentiveAbi","params","readErc20PeggedIncentiveOwner","readErc20PeggedIncentiveCurrentReward","readErc20PeggedIncentiveClaims","readErc20PeggedIncentiveTotalClaimed","address","readErc20PeggedIncentiveClaimed","readErc20PeggedIncentiveAsset","readErc20PeggedIncentivePeg","readErc20PeggedIncentiveReward","readErc20PeggedIncentiveLimit","payload","request","result","simulateErc20PeggedIncentiveClaim","prepareClaimPayload","writeErc20PeggedIncentiveClaim","simulateErc20PeggedIncentiveClawback","writeErc20PeggedIncentiveClawback","readErc20PeggedIncentiveIsClaimable","readErc20PeggedIncentiveGetPeg","totalClaimed","limit","_payload","_options","options","bytecode","prepareERC20PeggedIncentivePayload","amount","encodeAbiParameters","rewardAmount","netAmount","zeroAddress","_a","_b","_c","claimData","boostClaimData","decodeAbiParameters","ERC20PeggedIncentiveBases","RegistryType","ERC20PeggedIncentive","asset","peg","reward","manager","_ERC20PeggedVariableCriteriaIncentive","erc20PeggedVariableCriteriaIncentiveAbi","readErc20PeggedVariableCriteriaIncentiveOwner","readErc20PeggedVariableCriteriaIncentiveCurrentReward","readErc20PeggedVariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","DecodedArgsError","e","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","readErc20PeggedVariableCriteriaIncentiveClaims","readErc20PeggedVariableCriteriaIncentiveTotalClaimed","readErc20PeggedVariableCriteriaIncentiveClaimed","readErc20PeggedVariableCriteriaIncentiveAsset","readErc20PeggedVariableCriteriaIncentivePeg","readErc20PeggedVariableCriteriaIncentiveReward","readErc20PeggedVariableCriteriaIncentiveLimit","simulateErc20PeggedVariableCriteriaIncentiveClaim","writeErc20PeggedVariableCriteriaIncentiveClaim","simulateErc20PeggedVariableCriteriaIncentiveClawback","writeErc20PeggedVariableCriteriaIncentiveClawback","readErc20PeggedVariableCriteriaIncentiveIsClaimable","readErc20PeggedVariableCriteriaIncentiveGetPeg","readErc20PeggedVariableCriteriaIncentiveGetIncentiveCriteria","IncentiveCriteriaNotFoundError","prepareERC20PeggedVariableCriteriaIncentivePayload","_d","_e","signedAmount","claimAmount","maxReward","parseEther","ERC20PeggedVariableCriteriaIncentiveBases","ERC20PeggedVariableCriteriaIncentive","IncentiveByComponentInterface","APointsIncentive","PointsIncentive","AERC20Incentive","ERC20Incentive","AERC20PeggedVariableCriteriaIncentive","AERC20PeggedIncentive","AAllowListIncentive","AllowListIncentive","ACGDAIncentive","CGDAIncentive","AERC20VariableIncentive","ERC20VariableIncentive","AERC20VariableCriteriaIncentive","ERC20VariableCriteriaIncentive","incentiveFromAddress","interfaceId","readContract","aIncentiveAbi","Ctor","InvalidComponentInterfaceError"],"mappings":";;;;;;;;;;;;;;;;uudA2GaA,IA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