@boostxyz/sdk 5.3.1 → 6.0.0
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 +3 -3
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts +13 -3
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +216 -193
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +2 -2
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +24 -24
- 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.cjs.map +1 -1
- package/dist/Auth/PassthroughAuth.js +14 -14
- package/dist/Boost.cjs.map +1 -1
- package/dist/Boost.js.map +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +247 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +421 -259
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.js +43 -43
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budget-DMbfdTom.cjs +2 -0
- package/dist/{Budget-AoNx7uFd.cjs.map → Budget-DMbfdTom.cjs.map} +1 -1
- package/dist/Budget-DO6sGTIR.js +463 -0
- package/dist/{Budget-DYIV9iNK.js.map → Budget-DO6sGTIR.js.map} +1 -1
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +2 -2
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.js +53 -53
- package/dist/Budgets/ManagedBudgetWithFees.d.ts +26 -0
- package/dist/Budgets/ManagedBudgetWithFees.d.ts.map +1 -1
- 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 +15 -15
- package/dist/Incentive-Boviez4z.js +1036 -0
- package/dist/Incentive-Boviez4z.js.map +1 -0
- package/dist/Incentive-wM4zizTH.cjs +2 -0
- package/dist/Incentive-wM4zizTH.cjs.map +1 -0
- package/dist/Incentives/AllowListIncentive.cjs +1 -1
- package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
- package/dist/Incentives/AllowListIncentive.d.ts +9 -1
- package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +64 -47
- package/dist/Incentives/AllowListIncentive.js.map +1 -1
- package/dist/Incentives/CGDAIncentive.cjs +1 -1
- package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
- package/dist/Incentives/CGDAIncentive.d.ts +12 -1
- package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +64 -33
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts +37 -1
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +73 -49
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts +35 -0
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts +35 -0
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts +25 -0
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +24 -24
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.d.ts +35 -0
- package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +55 -38
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.d.ts +25 -0
- package/dist/Incentives/Incentive.d.ts.map +1 -1
- package/dist/Incentives/Incentive.js +2 -2
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts +8 -0
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +50 -28
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/SimpleDenyList-CW4RwwRw.js +133 -0
- package/dist/{SimpleDenyList-ByAr4X1r.js.map → SimpleDenyList-CW4RwwRw.js.map} +1 -1
- package/dist/SimpleDenyList-Cybtz7AK.cjs +2 -0
- package/dist/{SimpleDenyList-CsRXJPwm.cjs.map → SimpleDenyList-Cybtz7AK.cjs.map} +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +33 -33
- 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.js +26 -26
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.js +3 -3
- package/dist/deployments-CIXw_WKk.cjs +2 -0
- package/dist/deployments-CIXw_WKk.cjs.map +1 -0
- package/dist/{deployments-D0fs26TV.js → deployments-DqjtOTUr.js} +47 -47
- package/dist/{deployments-D0fs26TV.js.map → deployments-DqjtOTUr.js.map} +1 -1
- package/dist/deployments.json +24 -24
- package/dist/generated-DgXPUgXl.cjs +3 -0
- package/dist/generated-DgXPUgXl.cjs.map +1 -0
- package/dist/{generated-Cyvr_Tjx.js → generated-pJZHmRCK.js} +728 -459
- package/dist/generated-pJZHmRCK.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.js +137 -136
- package/package.json +1 -1
- package/src/Actions/EventAction.ts +108 -27
- package/src/BoostCore.test.ts +124 -2
- package/src/BoostCore.ts +227 -0
- package/src/Incentives/AllowListIncentive.ts +17 -0
- package/src/Incentives/CGDAIncentive.ts +31 -0
- package/src/Incentives/ERC20Incentive.ts +27 -0
- package/src/Incentives/ERC20PeggedIncentive.ts +18 -0
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentive.ts +26 -0
- package/src/Incentives/ERC20VariableIncentive.ts +18 -0
- package/src/Incentives/PointsIncentive.ts +22 -0
- package/dist/Budget-AoNx7uFd.cjs +0 -2
- package/dist/Budget-DYIV9iNK.js +0 -463
- package/dist/Incentive-BbkfwGOb.cjs +0 -2
- package/dist/Incentive-BbkfwGOb.cjs.map +0 -1
- package/dist/Incentive-qlnv5kQB.js +0 -991
- package/dist/Incentive-qlnv5kQB.js.map +0 -1
- package/dist/SimpleDenyList-ByAr4X1r.js +0 -133
- package/dist/SimpleDenyList-CsRXJPwm.cjs +0 -2
- package/dist/deployments-DoIOqxco.cjs +0 -2
- package/dist/deployments-DoIOqxco.cjs.map +0 -1
- package/dist/generated-Cyvr_Tjx.js.map +0 -1
- package/dist/generated-DtYPHhtX.cjs +0 -3
- package/dist/generated-DtYPHhtX.cjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllowListIncentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/AllowListIncentive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAUtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,
|
|
1
|
+
{"version":3,"file":"AllowListIncentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/AllowListIncentive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,qBAAqB,EAUtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EACtB,KAAK,GAAG,EAGT,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,aAAa,CAAC;AACrE,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,WAAW,EACjB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,qBAAqB,EAAE,CAAC;AAEjC;;;;;;GAMG;AACH,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,MAAM,MAAM,qBAAqB,CAC/B,KAAK,SAAS,iBAAiB,CAC7B,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C;;;;;;;;OAQG;cACa,KAAK,CACnB,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EACrC,MAAM,CAAC,EAAE,WAAW;IAKtB;;;;;;;;OAQG;cACa,QAAQ,CACtB,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EACrC,MAAM,CAAC,EAAE,WAAW;;;;IAgBtB;;;;;;;;OAQG;IACU,WAAW,CACtB,OAAO,EAAE,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,EACrC,MAAM,CAAC,EAAE,UAAU;IAUrB;;;;;;;OAOG;IACU,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU;IAI7C;;;;;;;OAOG;IACU,0BAA0B,CAAC,MAAM,CAAC,EAAE,UAAU;IAQ3D;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,yBAAyB,EACpC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;IAa1B;;;;;;OAMG;IACI,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,GAAG;IAU9C;;;;;;OAMG;IACI,cAAc;CAGtB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,gCAAgC,0BAG1C,yBAAyB,kBAQ3B,CAAC"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { A as
|
|
1
|
+
import { H as s, aj as n, ak as o, al as l, am as m, an as h, ao as u, ap as p, aq as w, ar as g } from "../generated-pJZHmRCK.js";
|
|
2
|
+
import { encodeAbiParameters as i, zeroHash as c } from "viem";
|
|
3
|
+
import { A as y } from "../deployments-DqjtOTUr.js";
|
|
4
4
|
import "@wagmi/core";
|
|
5
5
|
import { SimpleAllowList as A } from "../AllowLists/SimpleAllowList.js";
|
|
6
|
-
import "../SimpleDenyList-
|
|
7
|
-
import { DeployableTarget as
|
|
8
|
-
import { prepareClaimPayload as
|
|
9
|
-
import { RegistryType as
|
|
10
|
-
const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b61180b806100bd5f395ff3fe608060405260043610610129575f3560e01c8063715018a6116100aa578063c884ef831161006e578063c884ef831461038a578063db09da12146103c6578063dcc59b6f14610402578063f04e283e1461042c578063f2fde38b14610448578063fee81cf41461046457610129565b8063715018a6146102c657806387b9d25c146102d05780638da5cb5b146102fa578063a4d66daf14610324578063bb1757cf1461034e57610129565b806338d52e0f116100f157806338d52e0f146101f1578063439fab911461021b578063474f5a44146102435780634e7165a21461028057806354d1f13d146102bc57610129565b806301ffc9a71461012d57806307621eca14610169578063228cb7331461019357806325692962146101bd57806328d6183b146101c7575b5f80fd5b348015610138575f80fd5b50610153600480360381019061014e9190610ffc565b6104a0565b6040516101609190611041565b60405180910390f35b348015610174575f80fd5b5061017d610519565b60405161018a9190611072565b60405180910390f35b34801561019e575f80fd5b506101a7610521565b6040516101b49190611072565b60405180910390f35b6101c5610526565b005b3480156101d2575f80fd5b506101db610577565b6040516101e8919061109a565b60405180910390f35b3480156101fc575f80fd5b5061020561059e565b60405161021291906110f2565b60405180910390f35b348015610226575f80fd5b50610241600480360381019061023c919061116c565b6105b9565b005b34801561024e575f80fd5b506102696004803603810190610264919061116c565b610699565b6040516102779291906111b7565b60405180910390f35b34801561028b575f80fd5b506102a660048036038101906102a1919061116c565b6106cd565b6040516102b3919061124e565b60405180910390f35b6102c4610724565b005b6102ce61075d565b005b3480156102db575f80fd5b506102e4610770565b6040516102f191906112c9565b60405180910390f35b348015610305575f80fd5b5061030e610795565b60405161031b91906110f2565b60405180910390f35b34801561032f575f80fd5b506103386107bd565b6040516103459190611072565b60405180910390f35b348015610359575f80fd5b50610374600480360381019061036f919061130c565b6107c3565b6040516103819190611041565b60405180910390f35b348015610395575f80fd5b506103b060048036038101906103ab9190611369565b610969565b6040516103bd9190611041565b60405180910390f35b3480156103d1575f80fd5b506103ec60048036038101906103e7919061130c565b610986565b6040516103f99190611041565b60405180910390f35b34801561040d575f80fd5b50610416610a8c565b6040516104239190611072565b60405180910390f35b61044660048036038101906104419190611369565b610a92565b005b610462600480360381019061045d9190611369565b610ad0565b005b34801561046f575f80fd5b5061048a60048036038101906104859190611369565b610af9565b6040516104979190611072565b60405180910390f35b5f7fc2c281ec000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610512575061051182610b12565b5b9050919050565b5f8054905090565b5f5481565b5f61052f610b8b565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7fc2c281ec00000000000000000000000000000000000000000000000000000000905090565b5f73deaddeaddeaddeaddeaddeaddeaddeaddeaddead905090565b5f6105c2610b95565b905080546003825580156105f45760018160011c14303b106105eb5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f838381019061060591906114c2565b905061061033610bbe565b805f015160015f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060200151600281905550508015610694576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60605f67ffffffffffffffff8111156106e9576106e8611398565b5b6040519080825280601f01601f19166020018201604052801561071b5781602001600182028036833780820191505090505b50905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610765610c94565b61076e5f610ccb565b565b60015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60025481565b5f6107cc610c94565b60025460045f8154809291906107e19061151a565b91905055101580610838575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff165b1561086f576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff0219169083151502179055505f806108cf86610d91565b9150915060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633abb060483836040518363ffffffff1660e01b815260040161092f9291906116cf565b5f604051808303815f87803b158015610946575f80fd5b505af1158015610958573d5f803e3d5ffd5b505050506001925050509392505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b5f6002546004541080156109e1575060035f8573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b8015610a83575060015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e3f756de856040518263ffffffff1660e01b8152600401610a429190611727565b602060405180830381865afa158015610a5d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a81919061177d565b155b90509392505050565b60045481565b610a9a610c94565b63389a75e1600c52805f526020600c208054421115610ac057636f5e88185f526004601cfd5b5f815550610acd81610ccb565b50565b610ad8610c94565b8060601b610aed57637448fbae5f526004601cfd5b610af681610ccb565b50565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610b845750610b8382610eb0565b5b9050919050565b5f6202a300905090565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b610bc6610f29565b15610c3e577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415610c0057630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350610c91565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314610cc9576382b429005f526004601cfd5b565b610cd3610f29565b15610d38577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550610d8e565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b6060805f600167ffffffffffffffff811115610db057610daf611398565b5b604051908082528060200260200182016040528015610dde5781602001602082028036833780820191505090505b5090505f600167ffffffffffffffff811115610dfd57610dfc611398565b5b604051908082528060200260200182016040528015610e2b5781602001602082028036833780820191505090505b50905084825f81518110610e4257610e416117a8565b5b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001815f81518110610e9157610e906117a8565b5b6020026020010190151590811515815250508181935093505050915091565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480610f225750610f2182610f2d565b5b9050919050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b610fdb81610fa7565b8114610fe5575f80fd5b50565b5f81359050610ff681610fd2565b92915050565b5f6020828403121561101157611010610f9f565b5b5f61101e84828501610fe8565b91505092915050565b5f8115159050919050565b61103b81611027565b82525050565b5f6020820190506110545f830184611032565b92915050565b5f819050919050565b61106c8161105a565b82525050565b5f6020820190506110855f830184611063565b92915050565b61109481610fa7565b82525050565b5f6020820190506110ad5f83018461108b565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6110dc826110b3565b9050919050565b6110ec816110d2565b82525050565b5f6020820190506111055f8301846110e3565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261112c5761112b61110b565b5b8235905067ffffffffffffffff8111156111495761114861110f565b5b60208301915083600182028301111561116557611164611113565b5b9250929050565b5f806020838503121561118257611181610f9f565b5b5f83013567ffffffffffffffff81111561119f5761119e610fa3565b5b6111ab85828601611117565b92509250509250929050565b5f6040820190506111ca5f830185611063565b6111d760208301846110e3565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611220826111de565b61122a81856111e8565b935061123a8185602086016111f8565b61124381611206565b840191505092915050565b5f6020820190508181035f8301526112668184611216565b905092915050565b5f819050919050565b5f61129161128c611287846110b3565b61126e565b6110b3565b9050919050565b5f6112a282611277565b9050919050565b5f6112b382611298565b9050919050565b6112c3816112a9565b82525050565b5f6020820190506112dc5f8301846112ba565b92915050565b6112eb816110d2565b81146112f5575f80fd5b50565b5f81359050611306816112e2565b92915050565b5f805f6040848603121561132357611322610f9f565b5b5f611330868287016112f8565b935050602084013567ffffffffffffffff81111561135157611350610fa3565b5b61135d86828701611117565b92509250509250925092565b5f6020828403121561137e5761137d610f9f565b5b5f61138b848285016112f8565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6113ce82611206565b810181811067ffffffffffffffff821117156113ed576113ec611398565b5b80604052505050565b5f6113ff610f96565b905061140b82826113c5565b919050565b5f61141a826110d2565b9050919050565b61142a81611410565b8114611434575f80fd5b50565b5f8135905061144581611421565b92915050565b6114548161105a565b811461145e575f80fd5b50565b5f8135905061146f8161144b565b92915050565b5f6040828403121561148a57611489611394565b5b61149460406113f6565b90505f6114a384828501611437565b5f8301525060206114b684828501611461565b60208301525092915050565b5f604082840312156114d7576114d6610f9f565b5b5f6114e484828501611475565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6115248261105a565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611556576115556114ed565b5b600182019050919050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b611593816110d2565b82525050565b5f6115a4838361158a565b60208301905092915050565b5f602082019050919050565b5f6115c682611561565b6115d0818561156b565b93506115db8361157b565b805f5b8381101561160b5781516115f28882611599565b97506115fd836115b0565b9250506001810190506115de565b5085935050505092915050565b5f81519050919050565b5f82825260208201905092915050565b5f819050602082019050919050565b61164a81611027565b82525050565b5f61165b8383611641565b60208301905092915050565b5f602082019050919050565b5f61167d82611618565b6116878185611622565b935061169283611632565b805f5b838110156116c25781516116a98882611650565b97506116b483611667565b925050600181019050611695565b5085935050505092915050565b5f6040820190508181035f8301526116e781856115bc565b905081810360208301526116fb8184611673565b90509392505050565b50565b5f6117125f836111e8565b915061171d82611704565b5f82019050919050565b5f60408201905061173a5f8301846110e3565b818103602083015261174b81611707565b905092915050565b61175c81611027565b8114611766575f80fd5b50565b5f8151905061177781611753565b92915050565b5f6020828403121561179257611791610f9f565b5b5f61179f84828501611769565b91505092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea2646970667358221220935f4f4158c09791d7426626cfe654f31510f1ebb6755c8cb47532588b8661bf64736f6c634300081a0033", e = class e extends v {
|
|
6
|
+
import "../SimpleDenyList-CW4RwwRw.js";
|
|
7
|
+
import { DeployableTarget as V } from "../Deployable/DeployableTarget.js";
|
|
8
|
+
import { prepareClaimPayload as _ } from "../claiming.js";
|
|
9
|
+
import { RegistryType as P } from "../utils.js";
|
|
10
|
+
const C = "0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b8160c01c808260011c146073578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b610f75806100855f395ff3fe608060405260043610610162575f3560e01c8063715018a6116100c6578063c884ef831161007c578063f04e283e11610057578063f04e283e146103fd578063f2fde38b14610410578063fee81cf414610423575f80fd5b8063c884ef831461039b578063db09da12146103c9578063dcc59b6f146103e8575f80fd5b80638da5cb5b116100ac5780638da5cb5b14610334578063a4d66daf14610367578063bb1757cf1461037c575f80fd5b8063715018a61461030057806387b9d25c14610308575f80fd5b806338d52e0f1161011b578063474f5a4411610101578063474f5a44146102755780634e7165a2146102be57806354d1f13d146102f8575f80fd5b806338d52e0f1461020f578063439fab9114610256575f80fd5b8063228cb7331161014b578063228cb733146101b757806325692962146101cb57806328d6183b146101d5575f80fd5b806301ffc9a71461016657806307621eca1461019a575b5f80fd5b348015610171575f80fd5b50610185610180366004610bd8565b610454565b60405190151581526020015b60405180910390f35b3480156101a5575f80fd5b505f545b604051908152602001610191565b3480156101c2575f80fd5b506101a95f5481565b6101d36104af565b005b3480156101e0575f80fd5b506040517fc2c281ec000000000000000000000000000000000000000000000000000000008152602001610191565b34801561021a575f80fd5b5073deaddeaddeaddeaddeaddeaddeaddeaddeaddead5b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610191565b348015610261575f80fd5b506101d3610270366004610c63565b6104fc565b348015610280575f80fd5b5061029461028f366004610c63565b6105ed565b6040805192835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610191565b3480156102c9575f80fd5b506102eb6102d8366004610c63565b5050604080515f81526020810190915290565b6040516101919190610ca2565b6101d3610621565b6101d361065a565b348015610313575f80fd5b506001546102319073ffffffffffffffffffffffffffffffffffffffff1681565b34801561033f575f80fd5b507fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754610231565b348015610372575f80fd5b506101a960025481565b348015610387575f80fd5b50610185610396366004610d16565b61066d565b3480156103a6575f80fd5b506101856103b5366004610d67565b60036020525f908152604090205460ff1681565b3480156103d4575f80fd5b506101856103e3366004610d16565b6107e0565b3480156103f3575f80fd5b506101a960045481565b6101d361040b366004610d67565b6108ca565b6101d361041e366004610d67565b610907565b34801561042e575f80fd5b506101a961043d366004610d67565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fc2c281ec0000000000000000000000000000000000000000000000000000000014806104a957506104a98261092d565b92915050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf601132805460038255801561054d5760018160011c14303b106105445763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f61055b83850185610d82565b905061056633610982565b8051600180547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9092169190911790556020015160025580156105e8576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806040517fd623472500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b6106626109e5565b61066b5f610a1a565b565b5f6106766109e5565b60025460048054905f61068883610dff565b919050551015806106bd575073ffffffffffffffffffffffffffffffffffffffff84165f9081526003602052604090205460ff165b156106f4576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff84165f90815260036020526040812080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558061074b86610a7f565b6001546040517f3abb060400000000000000000000000000000000000000000000000000000000815292945090925073ffffffffffffffffffffffffffffffffffffffff1690633abb0604906107a79085908590600401610e5b565b5f604051808303815f87803b1580156107be575f80fd5b505af11580156107d0573d5f803e3d5ffd5b5060019998505050505050505050565b5f600254600454108015610819575073ffffffffffffffffffffffffffffffffffffffff84165f9081526003602052604090205460ff16155b80156108c25750600154604080517fe3f756de00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff878116600483015260248201929092525f604482015291169063e3f756de90606401602060405180830381865afa15801561089c573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108c09190610ef3565b155b949350505050565b6108d26109e5565b63389a75e1600c52805f526020600c2080544211156108f857636f5e88185f526004601cfd5b5f905561090481610a1a565b50565b61090f6109e5565b8060601b61092457637448fbae5f526004601cfd5b61090481610a1a565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806104a957506104a982610b42565b73ffffffffffffffffffffffffffffffffffffffff167fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754331461066b576382b429005f526004601cfd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b60408051600180825281830190925260609182915f916020808301908036833750506040805160018082528183019092529293505f9291506020808301908036833701905050905084825f81518110610ada57610ada610f12565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff16815250506001815f81518110610b2857610b28610f12565b911515602092830291909101909101529094909350915050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806104a957507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146104a9565b5f60208284031215610be8575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114610c17575f80fd5b9392505050565b5f8083601f840112610c2e575f80fd5b50813567ffffffffffffffff811115610c45575f80fd5b602083019150836020828501011115610c5c575f80fd5b9250929050565b5f8060208385031215610c74575f80fd5b823567ffffffffffffffff811115610c8a575f80fd5b610c9685828601610c1e565b90969095509350505050565b602081525f82518060208401528060208501604085015e5f6040828501015260407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011684010191505092915050565b73ffffffffffffffffffffffffffffffffffffffff81168114610904575f80fd5b5f805f60408486031215610d28575f80fd5b8335610d3381610cf5565b9250602084013567ffffffffffffffff811115610d4e575f80fd5b610d5a86828701610c1e565b9497909650939450505050565b5f60208284031215610d77575f80fd5b8135610c1781610cf5565b5f6040828403128015610d93575f80fd5b506040805190810167ffffffffffffffff81118282101715610ddc577f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040528235610dea81610cf5565b81526020928301359281019290925250919050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203610e54577f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5060010190565b604080825283519082018190525f9060208501906060840190835b81811015610eaa57835173ffffffffffffffffffffffffffffffffffffffff16835260209384019390920191600101610e76565b5050838103602080860191909152855180835291810192508501905f5b81811015610ee75782511515845260209384019390920191600101610ec7565b50919695505050505050565b5f60208284031215610f03575f80fd5b81518015158114610c17575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffdfea26469706673582212206a53b42071a063a12c6de7f3c53595b9f2c06373aae4a0ebd9d9bb586862922664736f6c634300081a0033", d = class d extends V {
|
|
11
11
|
constructor() {
|
|
12
|
-
super(...arguments), this.abi =
|
|
12
|
+
super(...arguments), this.abi = s;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* The owner of the allowList
|
|
@@ -20,7 +20,7 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
20
20
|
* @returns {Promise<Address>}
|
|
21
21
|
*/
|
|
22
22
|
async owner(f) {
|
|
23
|
-
return await
|
|
23
|
+
return await n(this._config, {
|
|
24
24
|
address: this.assertValidAddress(),
|
|
25
25
|
args: [],
|
|
26
26
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -36,7 +36,7 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
36
36
|
* @returns {Promise<bigint>}
|
|
37
37
|
*/
|
|
38
38
|
async claims(f) {
|
|
39
|
-
return await
|
|
39
|
+
return await o(this._config, {
|
|
40
40
|
address: this.assertValidAddress(),
|
|
41
41
|
args: [],
|
|
42
42
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -52,7 +52,7 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
52
52
|
* @returns {Promise<bigint>}
|
|
53
53
|
*/
|
|
54
54
|
async reward(f) {
|
|
55
|
-
return await
|
|
55
|
+
return await l(this._config, {
|
|
56
56
|
address: this.assertValidAddress(),
|
|
57
57
|
args: [],
|
|
58
58
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
@@ -68,12 +68,12 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
68
68
|
* @param {?ReadParams} [params]
|
|
69
69
|
* @returns {Promise<boolean>}
|
|
70
70
|
*/
|
|
71
|
-
async claimed(f,
|
|
72
|
-
return await
|
|
71
|
+
async claimed(f, a) {
|
|
72
|
+
return await m(this._config, {
|
|
73
73
|
address: this.assertValidAddress(),
|
|
74
74
|
args: [f],
|
|
75
75
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
76
|
-
...
|
|
76
|
+
...a
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
@@ -85,14 +85,14 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
85
85
|
* @returns {Promise<SimpleAllowList>}
|
|
86
86
|
*/
|
|
87
87
|
async allowList(f) {
|
|
88
|
-
const
|
|
88
|
+
const a = await h(this._config, {
|
|
89
89
|
address: this.assertValidAddress(),
|
|
90
90
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
91
91
|
...f
|
|
92
92
|
});
|
|
93
93
|
return new A(
|
|
94
94
|
{ config: this._config, account: this._account },
|
|
95
|
-
|
|
95
|
+
a
|
|
96
96
|
);
|
|
97
97
|
}
|
|
98
98
|
/**
|
|
@@ -104,7 +104,7 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
104
104
|
* @returns {Promise<bigint>}
|
|
105
105
|
*/
|
|
106
106
|
async limit(f) {
|
|
107
|
-
return await
|
|
107
|
+
return await u(this._config, {
|
|
108
108
|
address: this.assertValidAddress(),
|
|
109
109
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
110
110
|
...f
|
|
@@ -119,8 +119,8 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
119
119
|
* @param {?WriteParams} [params]
|
|
120
120
|
* @returns {Promise<true>} - return true if successful, otherwise revert
|
|
121
121
|
*/
|
|
122
|
-
async claim(f,
|
|
123
|
-
return await this.awaitResult(this.claimRaw(f,
|
|
122
|
+
async claim(f, a) {
|
|
123
|
+
return await this.awaitResult(this.claimRaw(f, a));
|
|
124
124
|
}
|
|
125
125
|
/**
|
|
126
126
|
* Claim a slot on the {@link SimpleAllowList}
|
|
@@ -131,18 +131,18 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
131
131
|
* @param {?WriteParams} [params]
|
|
132
132
|
* @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert
|
|
133
133
|
*/
|
|
134
|
-
async claimRaw(f,
|
|
135
|
-
const { request:
|
|
134
|
+
async claimRaw(f, a) {
|
|
135
|
+
const { request: b, result: e } = await p(
|
|
136
136
|
this._config,
|
|
137
137
|
{
|
|
138
138
|
address: this.assertValidAddress(),
|
|
139
|
-
args: [
|
|
139
|
+
args: [_(f)],
|
|
140
140
|
...this.optionallyAttachAccount(),
|
|
141
141
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
142
|
-
...
|
|
142
|
+
...a
|
|
143
143
|
}
|
|
144
144
|
);
|
|
145
|
-
return { hash: await
|
|
145
|
+
return { hash: await w(this._config, b), result: e };
|
|
146
146
|
}
|
|
147
147
|
/**
|
|
148
148
|
* Check if an incentive is claimable
|
|
@@ -153,12 +153,12 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
153
153
|
* @param {?ReadParams} [params]
|
|
154
154
|
* @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload
|
|
155
155
|
*/
|
|
156
|
-
async isClaimable(f,
|
|
156
|
+
async isClaimable(f, a) {
|
|
157
157
|
return await g(this._config, {
|
|
158
158
|
address: this.assertValidAddress(),
|
|
159
159
|
args: [f.target, "0x"],
|
|
160
160
|
// biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
|
|
161
|
-
...
|
|
161
|
+
...a
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
@@ -181,11 +181,11 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
181
181
|
* @returns {Promise<bigint>} - True if total claims is less than limit
|
|
182
182
|
*/
|
|
183
183
|
async getRemainingClaimPotential(f) {
|
|
184
|
-
const [
|
|
184
|
+
const [a, b] = await Promise.all([
|
|
185
185
|
this.claims(f),
|
|
186
186
|
this.limit(f)
|
|
187
187
|
]);
|
|
188
|
-
return
|
|
188
|
+
return b - a;
|
|
189
189
|
}
|
|
190
190
|
/**
|
|
191
191
|
* @inheritdoc
|
|
@@ -195,18 +195,35 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
195
195
|
* @param {?DeployableOptions} [_options]
|
|
196
196
|
* @returns {GenericDeployableParams}
|
|
197
197
|
*/
|
|
198
|
-
buildParameters(f,
|
|
199
|
-
const [
|
|
198
|
+
buildParameters(f, a) {
|
|
199
|
+
const [b, e] = this.validateDeploymentConfig(
|
|
200
200
|
f,
|
|
201
|
-
|
|
201
|
+
a
|
|
202
202
|
);
|
|
203
203
|
return {
|
|
204
|
-
abi:
|
|
204
|
+
abi: s,
|
|
205
205
|
bytecode: C,
|
|
206
|
-
args: [
|
|
207
|
-
...this.optionallyAttachAccount(
|
|
206
|
+
args: [R(b)],
|
|
207
|
+
...this.optionallyAttachAccount(e.account)
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
|
+
/**
|
|
211
|
+
* Generates a top-up payload for the AllowListIncentive contract.
|
|
212
|
+
*
|
|
213
|
+
* @public
|
|
214
|
+
* @param {bigint} netAmount The net number of slots to be added to the allowlist.
|
|
215
|
+
* @returns {Hex} The ABI-encoded top-up payload.
|
|
216
|
+
*/
|
|
217
|
+
getTopupPayload(f) {
|
|
218
|
+
var a;
|
|
219
|
+
return i(
|
|
220
|
+
[
|
|
221
|
+
{ type: "address", name: "allowList" },
|
|
222
|
+
{ type: "uint256", name: "limit" }
|
|
223
|
+
],
|
|
224
|
+
[((a = this.payload) == null ? void 0 : a.allowList) ?? c, f]
|
|
225
|
+
);
|
|
226
|
+
}
|
|
210
227
|
/**
|
|
211
228
|
* Builds the claim data for the AllowListIncentive.
|
|
212
229
|
*
|
|
@@ -215,27 +232,27 @@ const C = "0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f6
|
|
|
215
232
|
* @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.
|
|
216
233
|
*/
|
|
217
234
|
buildClaimData() {
|
|
218
|
-
return
|
|
235
|
+
return c;
|
|
219
236
|
}
|
|
220
237
|
};
|
|
221
|
-
|
|
238
|
+
d.bases = {
|
|
222
239
|
31337: void 0,
|
|
223
|
-
...
|
|
224
|
-
},
|
|
225
|
-
let
|
|
226
|
-
const
|
|
227
|
-
allowList:
|
|
240
|
+
...y
|
|
241
|
+
}, d.registryType = P.INCENTIVE;
|
|
242
|
+
let t = d;
|
|
243
|
+
const R = ({
|
|
244
|
+
allowList: r,
|
|
228
245
|
limit: f
|
|
229
|
-
}) =>
|
|
246
|
+
}) => i(
|
|
230
247
|
[
|
|
231
248
|
{ type: "address", name: "allowList" },
|
|
232
249
|
{ type: "uint256", name: "limit" }
|
|
233
250
|
],
|
|
234
|
-
[
|
|
251
|
+
[r, f]
|
|
235
252
|
);
|
|
236
253
|
export {
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
254
|
+
t as AllowListIncentive,
|
|
255
|
+
s as allowListIncentiveAbi,
|
|
256
|
+
R as prepareAllowListIncentivePayload
|
|
240
257
|
};
|
|
241
258
|
//# sourceMappingURL=AllowListIncentive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AllowListIncentive.js","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\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 { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases 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 allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, '0x'],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist 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 limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList","encodeAbiParameters"],"mappings":";;;;;;;;;g6YAsFaA,IAAN,MAAMA,UAA2BC,EAGtC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAA4B,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAME,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;A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A,MAAM,CAACC,EAAiCb,CAAO,CAAC;AAAA,MAChD,GAAG,KAAK,wBAAwBW,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,iBAAiB;AACf,WAAAG;AAAA,EACT;AACF;AApPE1B,EAAuB,QAAiC;AAAA,EACtD,OAAO;AAAA,EACP,GAAI2B;AAAA,GASN3B,EAAuB,eAA6B4B,EAAa;AAvB5D,IAAMC,IAAN7B;AA0QA,MAAMyB,IAAmC,CAAC;AAAA,EAC/C,WAAAK;AAAA,EACA,OAAAV;AACF,MACSW;AAAA,EACL;AAAA,IACE,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,IACrC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,EACnC;AAAA,EACA,CAACD,GAAWV,CAAK;AAAA;"}
|
|
1
|
+
{"version":3,"file":"AllowListIncentive.js","sources":["../../src/Incentives/AllowListIncentive.ts"],"sourcesContent":["import {\n allowListIncentiveAbi,\n readAllowListIncentiveAllowList,\n readAllowListIncentiveClaimed,\n readAllowListIncentiveClaims,\n readAllowListIncentiveIsClaimable,\n readAllowListIncentiveLimit,\n readAllowListIncentiveOwner,\n readAllowListIncentiveReward,\n simulateAllowListIncentiveClaim,\n writeAllowListIncentiveClaim,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/AllowListIncentive.sol/AllowListIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { AllowListIncentive as AllowListIncentiveBases } from '../../dist/deployments.json';\nimport { SimpleAllowList } from '../AllowLists/AllowList';\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 { allowListIncentiveAbi };\n\n/**\n * The object representation of a `AllowListIncentive.InitPayload`\n *\n * @export\n * @interface AllowListIncentivePayload\n * @typedef {AllowListIncentivePayload}\n */\nexport interface AllowListIncentivePayload {\n /**\n * The address to the allowlist to add claimers to.\n *\n * @type {Address}\n */\n allowList: Address;\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @type {bigint}\n */\n limit: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `AllowListIncentive` event types.\n *\n * @export\n * @typedef {AllowListIncentiveLog}\n * @template {ContractEventName<\n * typeof allowListIncentiveAbi\n * >} [event=ContractEventName<typeof allowListIncentiveAbi>]\n */\nexport type AllowListIncentiveLog<\n event extends ContractEventName<\n typeof allowListIncentiveAbi\n > = ContractEventName<typeof allowListIncentiveAbi>,\n> = GenericLog<typeof allowListIncentiveAbi, event>;\n\n/**\n * An incentive implementation that grants the claimer a slot on an {SimpleAllowList}\n * In order for any claim to be successful:\n * - The claimer must not already be on the allow list; and\n * - The maximum number of claims must not have been reached; and\n * - This contract must be authorized to modify the allow list\n *\n * @export\n * @class AllowListIncentive\n * @typedef {AllowListIncentive}\n * @extends {DeployableTarget<AllowListIncentivePayload>}\n */\nexport class AllowListIncentive extends DeployableTarget<\n AllowListIncentivePayload,\n typeof allowListIncentiveAbi\n> {\n public override readonly abi = allowListIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ALLOWLIST_INCENTIVE_BASE,\n ...(AllowListIncentiveBases 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 allowList\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readAllowListIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readAllowListIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readAllowListIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readAllowListIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The {@link SimpleAllowList} contract\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<SimpleAllowList>}\n */\n public async allowList(params?: ReadParams): Promise<SimpleAllowList> {\n const address = await readAllowListIncentiveAllowList(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return new SimpleAllowList(\n { config: this._config, account: this._account },\n address,\n );\n }\n\n /**\n * The maximum number of claims that can be made (one per address)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readAllowListIncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<true>} - return true if successful, otherwise revert\n */\n protected async claim(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim a slot on the {@link SimpleAllowList}\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - return true if successful, otherwise revert\n */\n protected async claimRaw(\n payload: Pick<ClaimPayload, 'target'>,\n params?: WriteParams,\n ) {\n const { request, result } = await simulateAllowListIncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeAllowListIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {Pick<ClaimPayload, 'target'>} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if the incentive is claimable based on the data payload\n */\n public async isClaimable(\n payload: Pick<ClaimPayload, 'target'>,\n params?: ReadParams,\n ) {\n return await readAllowListIncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [payload.target, '0x'],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Check if an incentive can potentially be claimed by comparing limit and total claims. Does not take requesting user or underlying allowlist 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 limit and total claims. Does not take requesting user or underlying allowlist into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?AllowListIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: AllowListIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: allowListIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareAllowListIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Generates a top-up payload for the AllowListIncentive contract.\n *\n * @public\n * @param {bigint} netAmount The net number of slots to be added to the allowlist.\n * @returns {Hex} The ABI-encoded top-up payload.\n */\n public getTopupPayload(netAmount: bigint): Hex {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [this.payload?.allowList ?? zeroHash, netAmount],\n );\n }\n\n /**\n * Builds the claim data for the AllowListIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as AllowListIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because AllowListIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link AllowListIncentivePayload}, properly encode a `AllowListIncentive.InitPayload` for use with {@link AllowListIncentive} initialization.\n *\n * @param {AllowListIncentivePayload} param0\n * @param {Address} param0.allowList - The address to the allowlist to add claimers to.\n * @param {bigint} param0.limit - The maximum number of claims that can be made (one per address)\n * @returns {Hex}\n */\nexport const prepareAllowListIncentivePayload = ({\n allowList,\n limit,\n}: AllowListIncentivePayload) => {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'allowList' },\n { type: 'uint256', name: 'limit' },\n ],\n [allowList, limit],\n );\n};\n"],"names":["_AllowListIncentive","DeployableTarget","allowListIncentiveAbi","params","readAllowListIncentiveOwner","readAllowListIncentiveClaims","readAllowListIncentiveReward","address","readAllowListIncentiveClaimed","readAllowListIncentiveAllowList","SimpleAllowList","readAllowListIncentiveLimit","payload","request","result","simulateAllowListIncentiveClaim","prepareClaimPayload","writeAllowListIncentiveClaim","readAllowListIncentiveIsClaimable","claims","limit","_payload","_options","options","bytecode","prepareAllowListIncentivePayload","netAmount","encodeAbiParameters","_a","zeroHash","AllowListIncentiveBases","RegistryType","AllowListIncentive","allowList"],"mappings":";;;;;;;;;ogQAsFaA,IAAN,MAAMA,UAA2BC,EAGtC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAA4B,KAAK,SAAS;AAAA,MACrD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAME,EAA6B,KAAK,SAAS;AAAA,MACtD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAA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AAwBW,EAAQ,OAAO;AAAA,IAAA;AAAA,EAEnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,gBAAgBG,GAAwB;;AACtC,WAAAC;AAAA,MACL;AAAA,QACE,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,QACrC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,MACnC;AAAA,MACA,GAACC,IAAA,KAAK,YAAL,gBAAAA,EAAc,cAAaC,GAAUH,CAAS;AAAA,IAAA;AAAA,EAEnD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASO,iBAAiB;AACf,WAAAG;AAAA,EACT;AACF;AArQE7B,EAAuB,QAAiC;AAAA,EACtD,OAAO;AAAA,EACP,GAAI8B;AAAA,GASN9B,EAAuB,eAA6B+B,EAAa;AAvB5D,IAAMC,IAANhC;AA2RA,MAAMyB,IAAmC,CAAC;AAAA,EAC/C,WAAAQ;AAAA,EACA,OAAAb;AACF,MACSO;AAAA,EACL;AAAA,IACE,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,IACrC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,EACnC;AAAA,EACA,CAACM,GAAWb,CAAK;AAAA;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-DtYPHhtX.cjs"),s=require("viem"),u=require("../deployments-DoIOqxco.cjs"),h=require("../Deployable/DeployableTarget.cjs"),i=require("../claiming.cjs"),n=require("../utils.cjs"),g="0x6080604052348015600e575f80fd5b50601b601f60201b60201c565b60b0565b5f602c608760201b60201c565b90508054600181161560455763f92ee8a95f526004601cfd5b8160c01c808260011c146082578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b612839806100bd5f395ff3fe6080604052600436106101ed575f3560e01c806354d1f13d1161010c578063c884ef831161009f578063ec87621c1161006e578063ec87621c1461069d578063f04e283e146106c7578063f2fde38b146106e3578063fe9fbb80146106ff578063fee81cf41461073b576101ed565b8063c884ef83146105d3578063db09da121461060f578063dcc213611461064b578063dcc59b6f14610673576101ed565b80638da5cb5b116100db5780638da5cb5b1461051b578063bb1757cf14610545578063be4994f814610581578063c78da39a146105a9576101ed565b806354d1f13d146104b0578063715018a6146104ba57806375b238fc146104c457806375ef18d0146104ee576101ed565b80632de9480711610184578063474f5a4411610153578063474f5a44146103df5780634a4ee7b11461041c5780634e7165a214610438578063514e62fc14610474576101ed565b80632de948071461032957806338d52e0f146103655780634359d28a1461038f578063439fab91146103b7576101ed565b80631cd64df4116101c05780631cd64df41461028f578063228cb733146102cb57806325692962146102f557806328d6183b146102ff576101ed565b806301ffc9a7146101f157806307621eca1461022d578063183a4f6e146102575780631c10893f14610273575b5f80fd5b3480156101fc575f80fd5b5061021760048036038101906102129190611a7c565b610777565b6040516102249190611ac1565b60405180910390f35b348015610238575f80fd5b506102416107f0565b60405161024e9190611af2565b60405180910390f35b610271600480360381019061026c9190611b35565b610899565b005b61028d60048036038101906102889190611bba565b6108a6565b005b34801561029a575f80fd5b506102b560048036038101906102b09190611bba565b6108bc565b6040516102c29190611ac1565b60405180910390f35b3480156102d6575f80fd5b506102df6108d2565b6040516102ec9190611af2565b60405180910390f35b6102fd6108d7565b005b34801561030a575f80fd5b50610313610928565b6040516103209190611c07565b60405180910390f35b348015610334575f80fd5b5061034f600480360381019061034a9190611c20565b61094f565b60405161035c9190611af2565b60405180910390f35b348015610370575f80fd5b50610379610968565b6040516103869190611c5a565b60405180910390f35b34801561039a575f80fd5b506103b560048036038101906103b09190611d29565b61098d565b005b3480156103c2575f80fd5b506103dd60048036038101906103d89190611dfc565b610a9b565b005b3480156103ea575f80fd5b5061040560048036038101906104009190611dfc565b610d39565b604051610413929190611e47565b60405180910390f35b61043660048036038101906104319190611bba565b610e8b565b005b348015610443575f80fd5b5061045e60048036038101906104599190611dfc565b610ea1565b60405161046b9190611ede565b60405180910390f35b34801561047f575f80fd5b5061049a60048036038101906104959190611bba565b610f71565b6040516104a79190611ac1565b60405180910390f35b6104b8610f88565b005b6104c2610fc1565b005b3480156104cf575f80fd5b506104d8610fd4565b6040516104e59190611af2565b60405180910390f35b3480156104f9575f80fd5b50610502610fd9565b6040516105129493929190611efe565b60405180910390f35b348015610526575f80fd5b5061052f610ff6565b60405161053c9190611c5a565b60405180910390f35b348015610550575f80fd5b5061056b60048036038101906105669190611f41565b61101e565b6040516105789190611ac1565b60405180910390f35b34801561058c575f80fd5b506105a760048036038101906105a29190611ff3565b611209565b005b3480156105b4575f80fd5b506105bd6112bf565b6040516105ca9190611af2565b60405180910390f35b3480156105de575f80fd5b506105f960048036038101906105f49190611c20565b6112c5565b6040516106069190611ac1565b60405180910390f35b34801561061a575f80fd5b5061063560048036038101906106309190611f41565b6112e2565b6040516106429190611ac1565b60405180910390f35b348015610656575f80fd5b50610671600480360381019061066c9190611ff3565b6112f5565b005b34801561067e575f80fd5b506106876113ab565b6040516106949190611af2565b60405180910390f35b3480156106a8575f80fd5b506106b16113b1565b6040516106be9190611af2565b60405180910390f35b6106e160048036038101906106dc9190611c20565b6113b6565b005b6106fd60048036038101906106f89190611c20565b6113f4565b005b34801561070a575f80fd5b5061072560048036038101906107209190611c20565b61141d565b6040516107329190611ac1565b60405180910390f35b348015610746575f80fd5b50610761600480360381019061075c9190611c20565b611470565b60405161076e9190611af2565b60405180910390f35b5f7f53cf8555000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806107e957506107e882611489565b5b9050919050565b5f80600280015442610802919061209e565b90505f61084f3060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661150290919063ffffffff16565b90505f610e106002600101548461086691906120d1565b610870919061213f565b600260030154610880919061216f565b905081811161088f5780610891565b815b935050505090565b6108a33382611535565b50565b6108ae611544565b6108b8828261157b565b5050565b5f81826108c88561094f565b1614905092915050565b5f5481565b5f6108e061158b565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f53cf855500000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b60075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600261099881611595565b8282905085859050146109d7576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610a93575f8484838181106109f8576109f76121a2565b5b9050602002016020810190610a0d91906121f9565b90506001151581151503610a5257610a4d878784818110610a3157610a306121a2565b5b9050602002016020810190610a469190611c20565b600161157b565b610a85565b610a84878784818110610a6857610a676121a2565b5b9050602002016020810190610a7d9190611c20565b6001611535565b5b5080806001019150506109d9565b505050505050565b5f610aa46115ca565b90508054600382558015610ad65760018160011c14303b10610acd5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610ae79190612341565b90505f610b1630835f015173ffffffffffffffffffffffffffffffffffffffff1661150290919063ffffffff16565b90508160800151811015610b6c57815f01518183608001516040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610b639392919061236c565b60405180910390fd5b5f82602001511480610b8157505f8260400151145b80610b8f57505f8260600151145b80610ba1575081602001518260800151105b15610bd8576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f015160075f6101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060405180608001604052808360400151815260200183606001518152602001428152602001836020015181525060025f820151815f01556020820151816001015560408201518160020155606082015181600301559050508160800151600681905550610c87336115f3565b610c968260a0015160016116c9565b815f015173ffffffffffffffffffffffffffffffffffffffff167f2364e5ed5f8639e9bae046dc67aabf43f410e931f25143a10f5e1a8744ad717e8360200151846040015185606001518660800151604051610cf59493929190611efe565b60405180910390a250508015610d34576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610d4681611595565b5f8585810190610d5691906124ba565b90505f8160200151806020019051810190610d719190612515565b9050610dc2825f01518260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661170a9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f015184604051602001610e36939291906125a5565b604051602081830303815290604052604051610e529190611ede565b60405180910390a28060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff16945094505050509250929050565b610e93611544565b610e9d8282611535565b5050565b60605f8383810190610eb39190612341565b9050604051806080016040528060016002811115610ed457610ed36125e1565b5b8152602001825f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808460800151815250604051602001610f379190612637565b604051602081830303815290604052815250604051602001610f59919061274d565b60405160208183030381529060405291505092915050565b5f8082610f7d8561094f565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610fc9611544565b610fd25f611753565b565b600281565b6002805f0154908060010154908060020154908060030154905084565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b5f611027611544565b61103084611819565b61107157836040517f4139d81d0000000000000000000000000000000000000000000000000000000081526004016110689190612790565b60405180910390fd5b6001805f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff02191690831515021790555060085f8154809291906110d7906127bc565b91905055505f6110e56107f0565b905042600280018190555060025f015481116111055760025f0154611116565b60025f015481611115919061209e565b5b60026003018190555061116b858260075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661170a9092919063ffffffff16565b8473ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d360075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1687846040516020016111d9939291906125a5565b6040516020818303038152906040526040516111f59190611ede565b60405180910390a260019150509392505050565b600261121481611595565b828290508585905014611253576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156112b7576112aa868683818110611276576112756121a2565b5b905060200201602081019061128b9190611c20565b85858481811061129e5761129d6121a2565b5b9050602002013561157b565b8080600101915050611255565b505050505050565b60065481565b6001602052805f5260405f205f915054906101000a900460ff1681565b5f6112ec84611819565b90509392505050565b600261130081611595565b82829050858590501461133f576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156113a357611396868683818110611362576113616121a2565b5b90506020020160208101906113779190611c20565b85858481811061138a576113896121a2565b5b90506020020135611535565b8080600101915050611341565b505050505050565b60085481565b600181565b6113be611544565b63389a75e1600c52805f526020600c2080544211156113e457636f5e88185f526004601cfd5b5f8155506113f181611753565b50565b6113fc611544565b8060601b61141157637448fbae5f526004601cfd5b61141a81611753565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff1661143d610ff6565b73ffffffffffffffffffffffffffffffffffffffff1614806114695750611468826002600117610f71565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806114fb57506114fa826118d8565b5b9050919050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b61154082825f611951565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314611579576382b429005f526004601cfd5b565b61158782826001611951565b5050565b5f6202a300905090565b638b78c6d8195433146115c757638b78c6d8600c52335f52806020600c2054166115c6576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b6115fb6119a9565b15611673577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392780541561163557630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3506116c6565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f5114171661174a576390b8ec185f526004601cfd5b5f603452505050565b61175b6119a9565b156117c0577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550611816565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f806118236107f0565b90505f8111801561187d57508061187a3060075f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661150290919063ffffffff16565b10155b80156118d0575060015f8473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16155b915050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061194a5750611949826119ad565b5b9050919050565b638b78c6d8600c52825f526020600c2080548381178361197357848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611a5b81611a27565b8114611a65575f80fd5b50565b5f81359050611a7681611a52565b92915050565b5f60208284031215611a9157611a90611a1f565b5b5f611a9e84828501611a68565b91505092915050565b5f8115159050919050565b611abb81611aa7565b82525050565b5f602082019050611ad45f830184611ab2565b92915050565b5f819050919050565b611aec81611ada565b82525050565b5f602082019050611b055f830184611ae3565b92915050565b611b1481611ada565b8114611b1e575f80fd5b50565b5f81359050611b2f81611b0b565b92915050565b5f60208284031215611b4a57611b49611a1f565b5b5f611b5784828501611b21565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611b8982611b60565b9050919050565b611b9981611b7f565b8114611ba3575f80fd5b50565b5f81359050611bb481611b90565b92915050565b5f8060408385031215611bd057611bcf611a1f565b5b5f611bdd85828601611ba6565b9250506020611bee85828601611b21565b9150509250929050565b611c0181611a27565b82525050565b5f602082019050611c1a5f830184611bf8565b92915050565b5f60208284031215611c3557611c34611a1f565b5b5f611c4284828501611ba6565b91505092915050565b611c5481611b7f565b82525050565b5f602082019050611c6d5f830184611c4b565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f840112611c9457611c93611c73565b5b8235905067ffffffffffffffff811115611cb157611cb0611c77565b5b602083019150836020820283011115611ccd57611ccc611c7b565b5b9250929050565b5f8083601f840112611ce957611ce8611c73565b5b8235905067ffffffffffffffff811115611d0657611d05611c77565b5b602083019150836020820283011115611d2257611d21611c7b565b5b9250929050565b5f805f8060408587031215611d4157611d40611a1f565b5b5f85013567ffffffffffffffff811115611d5e57611d5d611a23565b5b611d6a87828801611c7f565b9450945050602085013567ffffffffffffffff811115611d8d57611d8c611a23565b5b611d9987828801611cd4565b925092505092959194509250565b5f8083601f840112611dbc57611dbb611c73565b5b8235905067ffffffffffffffff811115611dd957611dd8611c77565b5b602083019150836001820283011115611df557611df4611c7b565b5b9250929050565b5f8060208385031215611e1257611e11611a1f565b5b5f83013567ffffffffffffffff811115611e2f57611e2e611a23565b5b611e3b85828601611da7565b92509250509250929050565b5f604082019050611e5a5f830185611ae3565b611e676020830184611c4b565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f611eb082611e6e565b611eba8185611e78565b9350611eca818560208601611e88565b611ed381611e96565b840191505092915050565b5f6020820190508181035f830152611ef68184611ea6565b905092915050565b5f608082019050611f115f830187611ae3565b611f1e6020830186611ae3565b611f2b6040830185611ae3565b611f386060830184611ae3565b95945050505050565b5f805f60408486031215611f5857611f57611a1f565b5b5f611f6586828701611ba6565b935050602084013567ffffffffffffffff811115611f8657611f85611a23565b5b611f9286828701611da7565b92509250509250925092565b5f8083601f840112611fb357611fb2611c73565b5b8235905067ffffffffffffffff811115611fd057611fcf611c77565b5b602083019150836020820283011115611fec57611feb611c7b565b5b9250929050565b5f805f806040858703121561200b5761200a611a1f565b5b5f85013567ffffffffffffffff81111561202857612027611a23565b5b61203487828801611c7f565b9450945050602085013567ffffffffffffffff81111561205757612056611a23565b5b61206387828801611f9e565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6120a882611ada565b91506120b383611ada565b92508282039050818111156120cb576120ca612071565b5b92915050565b5f6120db82611ada565b91506120e683611ada565b92508282026120f481611ada565b9150828204841483151761210b5761210a612071565b5b5092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61214982611ada565b915061215483611ada565b92508261216457612163612112565b5b828204905092915050565b5f61217982611ada565b915061218483611ada565b925082820190508082111561219c5761219b612071565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b6121d881611aa7565b81146121e2575f80fd5b50565b5f813590506121f3816121cf565b92915050565b5f6020828403121561220e5761220d611a1f565b5b5f61221b848285016121e5565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b61225e82611e96565b810181811067ffffffffffffffff8211171561227d5761227c612228565b5b80604052505050565b5f61228f611a16565b905061229b8282612255565b919050565b5f80fd5b5f60c082840312156122b9576122b8612224565b5b6122c360c0612286565b90505f6122d284828501611ba6565b5f8301525060206122e584828501611b21565b60208301525060406122f984828501611b21565b604083015250606061230d84828501611b21565b606083015250608061232184828501611b21565b60808301525060a061233584828501611ba6565b60a08301525092915050565b5f60c0828403121561235657612355611a1f565b5b5f612363848285016122a4565b91505092915050565b5f60608201905061237f5f830186611c4b565b61238c6020830185611ae3565b6123996040830184611ae3565b949350505050565b5f80fd5b5f67ffffffffffffffff8211156123bf576123be612228565b5b6123c882611e96565b9050602081019050919050565b828183375f83830152505050565b5f6123f56123f0846123a5565b612286565b905082815260208101848484011115612411576124106123a1565b5b61241c8482856123d5565b509392505050565b5f82601f83011261243857612437611c73565b5b81356124488482602086016123e3565b91505092915050565b5f6040828403121561246657612465612224565b5b6124706040612286565b90505f61247f84828501611ba6565b5f83015250602082013567ffffffffffffffff8111156124a2576124a16122a0565b5b6124ae84828501612424565b60208301525092915050565b5f602082840312156124cf576124ce611a1f565b5b5f82013567ffffffffffffffff8111156124ec576124eb611a23565b5b6124f884828501612451565b91505092915050565b5f8151905061250f81611b0b565b92915050565b5f6020828403121561252a57612529611a1f565b5b5f61253784828501612501565b91505092915050565b5f8160601b9050919050565b5f61255682612540565b9050919050565b5f6125678261254c565b9050919050565b61257f61257a82611b7f565b61255d565b82525050565b5f819050919050565b61259f61259a82611ada565b612585565b82525050565b5f6125b0828661256e565b6014820191506125c0828561256e565b6014820191506125d0828461258e565b602082019150819050949350505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b61261781611ada565b82525050565b602082015f8201516126315f85018261260e565b50505050565b5f60208201905061264a5f83018461261d565b92915050565b60038110612661576126606125e1565b5b50565b5f81905061267182612650565b919050565b5f61268082612664565b9050919050565b61269081612676565b82525050565b61269f81611b7f565b82525050565b5f82825260208201905092915050565b5f6126bf82611e6e565b6126c981856126a5565b93506126d9818560208601611e88565b6126e281611e96565b840191505092915050565b5f608083015f8301516127025f860182612687565b5060208301516127156020860182612696565b5060408301516127286040860182612696565b506060830151848203606086015261274082826126b5565b9150508091505092915050565b5f6020820190508181035f83015261276581846126ed565b905092915050565b50565b5f61277b5f83611e78565b91506127868261276d565b5f82019050919050565b5f6040820190506127a35f830184611c4b565b81810360208301526127b481612770565b905092915050565b5f6127c682611ada565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036127f8576127f7612071565b5b60018201905091905056fea264697066735822122073ee55b6a7ccfc1454034ecdb2d3de6f24f1abad0f5fba5b13b1a9b1a80ddec664736f6c634300081a0033",t=class t extends h.DeployableTarget{constructor(){super(...arguments),this.abi=a.A}async owner(f){return await a.yT(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a.iT(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return await a.mT(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.aT(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.tT(this._config,{address:this.assertValidAddress(),...f})}async cgdaParams(f){const[b,e,d,c]=await a.nT(this._config,{address:this.assertValidAddress(),...f});return{rewardDecay:b,rewardBoost:e,lastClaimTime:d,currentReward:c}}async totalBudget(f){return await a.vT(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.ST(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.AT(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.FT(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.gT(this._config,e),result:d}}async isClaimable(f,b){return await a.lT(this._config,{address:this.assertValidAddress(),args:[f.target,f.data],...b})}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.currentReward(f),n.getErc20Balance(this._config,await this.asset(),this.assertValidAddress(),f)]);return e-b}async currentReward(f){return await a.sT(this._config,{address:this.assertValidAddress(),...f})}async getTotalBudget(f){var b;return((b=this.payload)==null?void 0:b.totalBudget)!==void 0?this.payload.totalBudget:await this.totalBudget(f)}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.A,bytecode:g,args:[l(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return s.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return s.zeroHash}};t.bases={31337:void 0,...u.CGDAIncentive},t.registryType=n.RegistryType.INCENTIVE;let r=t;function l({asset:o,initialReward:f,rewardDecay:b,rewardBoost:e,totalBudget:d,manager:c}){return s.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"initialReward"},{type:"uint256",name:"rewardDecay"},{type:"uint256",name:"rewardBoost"},{type:"uint256",name:"totalBudget"},{type:"address",name:"manager"}],[o,f,b,e,d,c])}exports.cgdaIncentiveAbi=a.A;exports.CGDAIncentive=r;exports.prepareCGDAIncentivePayload=l;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-DgXPUgXl.cjs"),t=require("viem"),u=require("../deployments-CIXw_WKk.cjs"),h=require("../Deployable/DeployableTarget.cjs"),i=require("../claiming.cjs"),n=require("../utils.cjs"),y="0x6080604052348015600e575f80fd5b5060156019565b6078565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b8160c01c808260011c146073578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b611b65806100855f395ff3fe6080604052600436106101f5575f3560e01c806354d1f13d11610117578063c884ef83116100ac578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b146105f8578063fe9fbb801461060b578063fee81cf41461062a575f80fd5b8063ec87621c146105d1578063f04e283e146105e5575f80fd5b8063c884ef8314610550578063db09da121461057e578063dcc213611461059d578063dcc59b6f146105bc575f80fd5b80638da5cb5b116100e75780638da5cb5b146104e5578063bb1757cf146104fd578063be4994f81461051c578063c78da39a1461053b575f80fd5b806354d1f13d1461047f578063715018a61461048757806375b238fc1461048f57806375ef18d0146104a3575f80fd5b80632de948071161018d578063474f5a441161015d578063474f5a44146103c25780634a4ee7b11461040b5780634e7165a21461041e578063514e62fc1461044a575f80fd5b80632de948071461030257806338d52e0f146103335780634359d28a14610384578063439fab91146103a3575f80fd5b80631cd64df4116101c85780631cd64df414610277578063228cb733146102ac57806325692962146102c057806328d6183b146102c8575f80fd5b806301ffc9a7146101f957806307621eca1461022d578063183a4f6e1461024f5780631c10893f14610264575b5f80fd5b348015610204575f80fd5b506102186102133660046114f8565b61065b565b60405190151581526020015b60405180910390f35b348015610238575f80fd5b506102416106b6565b604051908152602001610224565b61026261025d366004611537565b610736565b005b610262610272366004611576565b610743565b348015610282575f80fd5b50610218610291366004611576565b638b78c6d8600c9081525f9290925260209091205481161490565b3480156102b7575f80fd5b506102415f5481565b610262610759565b3480156102d3575f80fd5b506040517f53cf8555000000000000000000000000000000000000000000000000000000008152602001610224565b34801561030d575f80fd5b5061024161031c36600461159e565b638b78c6d8600c9081525f91909152602090205490565b34801561033e575f80fd5b5060075461035f9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff9091168152602001610224565b34801561038f575f80fd5b5061026261039e3660046115ff565b6107a6565b3480156103ae575f80fd5b506102626103bd3660046116a9565b6108a0565b3480156103cd575f80fd5b506103e16103dc3660046116a9565b610b63565b6040805192835273ffffffffffffffffffffffffffffffffffffffff909116602083015201610224565b610262610419366004611576565b610c90565b348015610429575f80fd5b5061043d6104383660046116a9565b610ca2565b6040516102249190611716565b348015610455575f80fd5b50610218610464366004611576565b638b78c6d8600c9081525f9290925260209091205416151590565b610262610d60565b610262610d99565b34801561049a575f80fd5b50610241600281565b3480156104ae575f80fd5b506002546003546004546005546104c59392919084565b604080519485526020850193909352918301526060820152608001610224565b3480156104f0575f80fd5b50638b78c6d8195461035f565b348015610508575f80fd5b50610218610517366004611728565b610dac565b348015610527575f80fd5b506102626105363660046115ff565b610f82565b348015610546575f80fd5b5061024160065481565b34801561055b575f80fd5b5061021861056a36600461159e565b60016020525f908152604090205460ff1681565b348015610589575f80fd5b50610218610598366004611728565b611020565b3480156105a8575f80fd5b506102626105b73660046115ff565b611032565b3480156105c7575f80fd5b5061024160085481565b3480156105dc575f80fd5b50610241600181565b6102626105f336600461159e565b6110d0565b61026261060636600461159e565b61110a565b348015610616575f80fd5b5061021861062536600461159e565b611130565b348015610635575f80fd5b5061024161064436600461159e565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f53cf85550000000000000000000000000000000000000000000000000000000014806106b057506106b08261118f565b92915050565b6004545f9081906106c790426117a4565b6007549091505f906106ef9073ffffffffffffffffffffffffffffffffffffffff16306111e4565b90505f610e106002600101548461070691906117b7565b61071091906117ce565b60055461071d9190611806565b905081811161072c578061072e565b815b935050505090565b6107403382611217565b50565b61074b611222565b610755828261123c565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b60026107b181611248565b8382146107ea576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b84811015610898575f84848381811061080757610807611819565b905060200201602081019061081c9190611846565b905080151560010361085e5761085987878481811061083d5761083d611819565b9050602002016020810190610852919061159e565b600161123c565b61088f565b61088f87878481811061087357610873611819565b9050602002016020810190610888919061159e565b6001611217565b506001016107ec565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf60113280546003825580156108f15760018160011c14303b106108e85763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f6108ff838501856118ec565b80519091505f906109269073ffffffffffffffffffffffffffffffffffffffff16306111e4565b9050816080015181101561099757815160808301516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff90921660048301526024820183905260448201526064015b60405180910390fd5b602082015115806109aa57506040820151155b806109b757506060820151155b806109c9575081602001518260800151105b15610a00576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8151600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90921691909117905560408051608080820183528285015180835260608087015160208086018290524296860187905288015191909401819052600291909155600392909255600492909255600555820151600655610a9b33611279565b610aaa8260a0015160016112c1565b815f015173ffffffffffffffffffffffffffffffffffffffff167f2364e5ed5f8639e9bae046dc67aabf43f410e931f25143a10f5e1a8744ad717e8360200151846040015185606001518660800151604051610b1f949392919093845260208401929092526040830152606082015260800190565b60405180910390a250508015610b5e576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610b7081611248565b5f610b7d8587018761196f565b90505f8160200151806020019051810190610b989190611a46565b8251600754919250610bc19173ffffffffffffffffffffffffffffffffffffffff169083611302565b81516007546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d39060680160408051601f1981840301815290829052610c6191611716565b60405180910390a260075490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610c98611222565b6107558282611217565b60605f610cb1838501856118ec565b60408051608081019091529091508060018152602001825f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff16815260200160405180602001604052808460800151815250604051602001610d289151815260200190565b60408051601f19818403018152918152915251610d489190602001611a5d565b60405160208183030381529060405291505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610da1611222565b610daa5f61134b565b565b5f610db5611222565b610dbe84611395565b610e1b57604080517f4139d81d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8616600482015260248101919091525f604482015260640161098e565b73ffffffffffffffffffffffffffffffffffffffff84165f908152600160208190526040822080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690911790556008805491610e7883611af8565b91905055505f610e866106b6565b426004556002549091508111610e9e57600254610eab565b600254610eab90826117a4565b600555600754610ed29073ffffffffffffffffffffffffffffffffffffffff168683611302565b6007546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529187901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8616907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d39060680160408051601f1981840301815290829052610f6f91611716565b60405180910390a2506001949350505050565b6002610f8d81611248565b838214610fc6576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8481101561089857611018868683818110610fe557610fe5611819565b9050602002016020810190610ffa919061159e565b85858481811061100c5761100c611819565b9050602002013561123c565b600101610fc8565b5f61102a84611395565b949350505050565b600261103d81611248565b838214611076576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b84811015610898576110c886868381811061109557611095611819565b90506020020160208101906110aa919061159e565b8585848181106110bc576110bc611819565b90506020020135611217565b600101611078565b6110d8611222565b63389a75e1600c52805f526020600c2080544211156110fe57636f5e88185f526004601cfd5b5f90556107408161134b565b611112611222565b8060601b61112757637448fbae5f526004601cfd5b6107408161134b565b5f8173ffffffffffffffffffffffffffffffffffffffff16611155638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806106b05750638b78c6d8600c9081525f839052602090205460031615156106b0565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806106b057506106b08261140b565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b61075582825f6114a1565b638b78c6d819543314610daa576382b429005f526004601cfd5b610755828260016114a1565b638b78c6d81954331461074057638b78c6d8600c52335f52806020600c205416610740576382b429005f526004601cfd5b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f51141716611342576390b8ec185f526004601cfd5b5f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f8061139f6106b6565b90505f811180156113d3575060075481906113d09073ffffffffffffffffffffffffffffffffffffffff16306111e4565b10155b8015611404575073ffffffffffffffffffffffffffffffffffffffff83165f9081526001602052604090205460ff16155b9392505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806106b057507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146106b0565b638b78c6d8600c52825f526020600c208054838117836114c2575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f60208284031215611508575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611404575f80fd5b5f60208284031215611547575f80fd5b5035919050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611571575f80fd5b919050565b5f8060408385031215611587575f80fd5b6115908361154e565b946020939093013593505050565b5f602082840312156115ae575f80fd5b6114048261154e565b5f8083601f8401126115c7575f80fd5b50813567ffffffffffffffff8111156115de575f80fd5b6020830191508360208260051b85010111156115f8575f80fd5b9250929050565b5f805f8060408587031215611612575f80fd5b843567ffffffffffffffff811115611628575f80fd5b611634878288016115b7565b909550935050602085013567ffffffffffffffff811115611653575f80fd5b61165f878288016115b7565b95989497509550505050565b5f8083601f84011261167b575f80fd5b50813567ffffffffffffffff811115611692575f80fd5b6020830191508360208285010111156115f8575f80fd5b5f80602083850312156116ba575f80fd5b823567ffffffffffffffff8111156116d0575f80fd5b6116dc8582860161166b565b90969095509350505050565b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f61140460208301846116e8565b5f805f6040848603121561173a575f80fd5b6117438461154e565b9250602084013567ffffffffffffffff81111561175e575f80fd5b61176a8682870161166b565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b818103818111156106b0576106b0611777565b80820281158282048414176106b0576106b0611777565b5f82611801577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b500490565b808201808211156106b0576106b0611777565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611856575f80fd5b81358015158114611404575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6040805190810167ffffffffffffffff811182821017156118b5576118b5611865565b60405290565b604051601f8201601f1916810167ffffffffffffffff811182821017156118e4576118e4611865565b604052919050565b5f60c08284031280156118fd575f80fd5b5060405160c0810167ffffffffffffffff8111828210171561192157611921611865565b60405261192d8361154e565b81526020838101359082015260408084013590820152606080840135908201526080808401359082015261196360a0840161154e565b60a08201529392505050565b5f6020828403121561197f575f80fd5b813567ffffffffffffffff811115611995575f80fd5b8201604081850312156119a6575f80fd5b6119ae611892565b6119b78261154e565b8152602082013567ffffffffffffffff8111156119d2575f80fd5b80830192505084601f8301126119e6575f80fd5b813567ffffffffffffffff811115611a0057611a00611865565b611a136020601f19601f840116016118bb565b818152866020838601011115611a27575f80fd5b816020850160208301375f602092820183015290820152949350505050565b5f60208284031215611a56575f80fd5b5051919050565b602081525f825160038110611a99577f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff6040840151166060830152606083015160808084015261102a60a08401826116e8565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203611b2857611b28611777565b506001019056fea2646970667358221220e6b93f6915e88cb71a52f2fc66651bb20e78e4fc576be1786f6530ebff60d6b264736f6c634300081a0033",s=class s extends h.DeployableTarget{constructor(){super(...arguments),this.abi=a.N}async owner(f){return await a.$2(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a.D2(this._config,{address:this.assertValidAddress(),args:[],...f})}async reward(f){return await a.K2(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.L2(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.P2(this._config,{address:this.assertValidAddress(),...f})}async cgdaParams(f){const[b,e,d,c]=await a._2(this._config,{address:this.assertValidAddress(),...f});return{rewardDecay:b,rewardBoost:e,lastClaimTime:d,currentReward:c}}async totalBudget(f){return await a.eg(this._config,{address:this.assertValidAddress(),...f})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.wg(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.ag(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.Tg(this._config,{address:this.assertValidAddress(),args:[i.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.ig(this._config,e),result:d}}async isClaimable(f,b){return await a.j2(this._config,{address:this.assertValidAddress(),args:[f.target,f.data],...b})}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.currentReward(f),n.getErc20Balance(this._config,await this.asset(),this.assertValidAddress(),f)]);return e-b}async currentReward(f){return await a.W2(this._config,{address:this.assertValidAddress(),...f})}async getTotalBudget(f){var b;return((b=this.payload)==null?void 0:b.totalBudget)!==void 0?this.payload.totalBudget:await this.totalBudget(f)}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.N,bytecode:y,args:[o(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return t.encodeAbiParameters([{type:"uint256"}],[f])}async getTopupPayload(f){var b,e,d,c;return t.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"initialReward"},{type:"uint256",name:"rewardDecay"},{type:"uint256",name:"rewardBoost"},{type:"uint256",name:"totalBudget"},{type:"address",name:"manager"}],[await this.asset()??t.zeroHash,((b=this.payload)==null?void 0:b.initialReward)??0n,((e=this.payload)==null?void 0:e.rewardDecay)??0n,((d=this.payload)==null?void 0:d.rewardBoost)??0n,f,((c=this.payload)==null?void 0:c.manager)??t.zeroHash])}buildClaimData(){return t.zeroHash}};s.bases={31337:void 0,...u.CGDAIncentive},s.registryType=n.RegistryType.INCENTIVE;let r=s;function o({asset:l,initialReward:f,rewardDecay:b,rewardBoost:e,totalBudget:d,manager:c}){return t.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint256",name:"initialReward"},{type:"uint256",name:"rewardDecay"},{type:"uint256",name:"rewardBoost"},{type:"uint256",name:"totalBudget"},{type:"address",name:"manager"}],[l,f,b,e,d,c])}exports.cgdaIncentiveAbi=a.N;exports.CGDAIncentive=r;exports.prepareCGDAIncentivePayload=o;
|
|
2
2
|
//# sourceMappingURL=CGDAIncentive.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CGDAIncentive.cjs","sources":["../../src/Incentives/CGDAIncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { CGDAIncentive as CGDAIncentiveBases } 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 getErc20Balance,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\n\n/**\n * The object representation of a `CGDAIncentive.InitPayload`\n *\n * @export\n * @interface CGDAIncentivePayload\n * @typedef {CGDAIncentivePayload}\n */\nexport interface CGDAIncentivePayload {\n /**\n * The address of the ERC20-like token\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The initial reward amount\n *\n * @type {bigint}\n */\n initialReward: bigint;\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The total budget for the incentive\n *\n * @type {bigint}\n */\n totalBudget: bigint;\n /**\n * The entity that can `clawback` funds\n *\n * @type {Address}\n */\n manager: Address;\n}\n\n/**\n * The configuration parameters for the CGDAIncentive\n *\n * @export\n * @interface CGDAParameters\n * @typedef {CGDAParameters}\n */\nexport interface CGDAParameters {\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The timestamp of the last claim\n *\n * @type {bigint}\n */\n lastClaimTime: bigint;\n /**\n * The current reward amount\n *\n * @type {bigint}\n */\n currentReward: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,\n ...(CGDAIncentiveBases 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 incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(params?: ReadParams): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(params?: ReadParams) {\n return await readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [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<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [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<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [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 readCgdaIncentiveIsClaimable(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 * Check if any claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if asset balance minus current reward is greater than 0\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 balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - Asset balance minus current reward\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [currentReward, currentBalance] = await Promise.all([\n this.currentReward(params),\n getErc20Balance(\n this._config,\n await this.asset(),\n this.assertValidAddress(),\n params,\n ),\n ]);\n return currentBalance - currentReward;\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * 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 if (this.payload?.totalBudget !== undefined) {\n return this.payload.totalBudget;\n }\n return await this.totalBudget(params);\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\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 CGDAIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as CGDAIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because CGDAIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link CGDAIncentivePayload}, properly encode a `CGDAIncentive.InitPayload` for use with {@link CGDAIncentive} initialization.\n *\n * @param {CGDAIncentivePayload} param0\n * @param {Address} param0.asset - The address of the ERC20-like token\n * @param {bigint} param0.initialReward - The initial reward amount\n * @param {bigint} param0.rewardDecay - The amount to subtract from the current reward after each claim\n * @param {bigint} param0.rewardBoost - The amount by which the reward increases for each hour without a claim (continuous linear increase)\n * @param {bigint} param0.totalBudget - The total budget for the incentive\n * @returns {Hex}\n */\nexport function prepareCGDAIncentivePayload({\n asset,\n initialReward,\n rewardDecay,\n rewardBoost,\n totalBudget,\n manager,\n}: CGDAIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n { type: 'address', name: 'manager' },\n ],\n [asset, initialReward, rewardDecay, rewardBoost, totalBudget, manager],\n );\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","currentBalance","getErc20Balance","readCgdaIncentiveCurrentReward","_a","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","amount","encodeAbiParameters","zeroHash","CGDAIncentiveBases","RegistryType","CGDAIncentive","asset","initialReward","totalBudget","manager"],"mappings":"kxpBAiJaA,EAAN,MAAMA,UAAsBC,EAAAA,gBAGjC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAA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ncentive.ts"],"sourcesContent":["import {\n cgdaIncentiveAbi,\n readCgdaIncentiveAsset,\n readCgdaIncentiveCgdaParams,\n readCgdaIncentiveClaimed,\n readCgdaIncentiveClaims,\n readCgdaIncentiveCurrentReward,\n readCgdaIncentiveIsClaimable,\n readCgdaIncentiveOwner,\n readCgdaIncentiveReward,\n readCgdaIncentiveTotalBudget,\n simulateCgdaIncentiveClaim,\n simulateCgdaIncentiveClawback,\n writeCgdaIncentiveClaim,\n writeCgdaIncentiveClawback,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/CGDAIncentive.sol/CGDAIncentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroHash,\n} from 'viem';\nimport { CGDAIncentive as CGDAIncentiveBases } 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 getErc20Balance,\n} from '../utils';\n\nexport { cgdaIncentiveAbi };\n\n/**\n * The object representation of a `CGDAIncentive.InitPayload`\n *\n * @export\n * @interface CGDAIncentivePayload\n * @typedef {CGDAIncentivePayload}\n */\nexport interface CGDAIncentivePayload {\n /**\n * The address of the ERC20-like token\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The initial reward amount\n *\n * @type {bigint}\n */\n initialReward: bigint;\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The total budget for the incentive\n *\n * @type {bigint}\n */\n totalBudget: bigint;\n /**\n * The entity that can `clawback` funds\n *\n * @type {Address}\n */\n manager: Address;\n}\n\n/**\n * The configuration parameters for the CGDAIncentive\n *\n * @export\n * @interface CGDAParameters\n * @typedef {CGDAParameters}\n */\nexport interface CGDAParameters {\n /**\n * The amount to subtract from the current reward after each claim\n *\n * @type {bigint}\n */\n rewardDecay: bigint;\n /**\n * The amount by which the reward increases for each hour without a claim (continuous linear increase)\n *\n * @type {bigint}\n */\n rewardBoost: bigint;\n /**\n * The timestamp of the last claim\n *\n * @type {bigint}\n */\n lastClaimTime: bigint;\n /**\n * The current reward amount\n *\n * @type {bigint}\n */\n currentReward: bigint;\n}\n\n/**\n * A generic `viem.Log` event with support for `CGDAIncentive` event types.\n *\n * @export\n * @typedef {CGDAIncentiveLog}\n * @template {ContractEventName<typeof cgdaIncentiveAbi>} [event=ContractEventName<\n * typeof cgdaIncentiveAbi\n * >]\n */\nexport type CGDAIncentiveLog<\n event extends ContractEventName<typeof cgdaIncentiveAbi> = ContractEventName<\n typeof cgdaIncentiveAbi\n >,\n> = GenericLog<typeof cgdaIncentiveAbi, event>;\n\n/**\n * Continuous Gradual Dutch Auction Incentive.\n * An CGDA incentive implementation with reward amounts adjusting dynamically based on claim volume.\n *\n * @export\n * @class CGDAIncentive\n * @typedef {CGDAIncentive}\n * @extends {DeployableTarget<CGDAIncentivePayload>}\n */\nexport class CGDAIncentive extends DeployableTarget<\n CGDAIncentivePayload,\n typeof cgdaIncentiveAbi\n> {\n public override readonly abi = cgdaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_CGDA_INCENTIVE_BASE,\n ...(CGDAIncentiveBases 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 incentive's owner.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readCgdaIncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readCgdaIncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readCgdaIncentiveReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Get the claim status for a user\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readCgdaIncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The CGDA-like token used for the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readCgdaIncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The configuration parameters for the CGDAIncentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<CGDAParameters>}\n */\n public async cgdaParams(params?: ReadParams): Promise<CGDAParameters> {\n const [rewardDecay, rewardBoost, lastClaimTime, currentReward] =\n await readCgdaIncentiveCgdaParams(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n return {\n rewardDecay,\n rewardBoost,\n lastClaimTime,\n currentReward,\n };\n }\n\n /**\n * The total budget of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async totalBudget(params?: ReadParams) {\n return await readCgdaIncentiveTotalBudget(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [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<boolean>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClaim(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n const hash = await writeCgdaIncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [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<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateCgdaIncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeCgdaIncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [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 readCgdaIncentiveIsClaimable(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 * Check if any claims remain by comparing the incentive's balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if asset balance minus current reward is greater than 0\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 balance against the current reward. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - Asset balance minus current reward\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [currentReward, currentBalance] = await Promise.all([\n this.currentReward(params),\n getErc20Balance(\n this._config,\n await this.asset(),\n this.assertValidAddress(),\n params,\n ),\n ]);\n return currentBalance - currentReward;\n }\n\n /**\n * Calculates the current reward based on the time since the last claim.\n * The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget.\n * For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readCgdaIncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * 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 if (this.payload?.totalBudget !== undefined) {\n return this.payload.totalBudget;\n }\n return await this.totalBudget(params);\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?CGDAIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: CGDAIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: cgdaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareCGDAIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\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 * Generates a top-up payload for the CGDAIncentive contract.\n *\n * In this approach, we treat a \"top-up\" as incrementing the existing `totalBudget`\n * in the incentive by `netAmount`. The entire payload is re-encoded with the updated budget.\n *\n * @public\n * @param {bigint} netAmount The additional tokens to add to `totalBudget`.\n * @returns {Hex} The ABI-encoded, updated CGDAIncentive payload.\n */\n public async getTopupPayload(netAmount: bigint): Promise<Hex> {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n { type: 'address', name: 'manager' },\n ],\n [\n (await this.asset()) ?? zeroHash,\n this.payload?.initialReward ?? 0n,\n this.payload?.rewardDecay ?? 0n,\n this.payload?.rewardBoost ?? 0n,\n netAmount,\n this.payload?.manager ?? zeroHash,\n ],\n );\n }\n\n /**\n * Builds the claim data for the CGDAIncentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as CGDAIncentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because CGDAIncentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link CGDAIncentivePayload}, properly encode a `CGDAIncentive.InitPayload` for use with {@link CGDAIncentive} initialization.\n *\n * @param {CGDAIncentivePayload} param0\n * @param {Address} param0.asset - The address of the ERC20-like token\n * @param {bigint} param0.initialReward - The initial reward amount\n * @param {bigint} param0.rewardDecay - The amount to subtract from the current reward after each claim\n * @param {bigint} param0.rewardBoost - The amount by which the reward increases for each hour without a claim (continuous linear increase)\n * @param {bigint} param0.totalBudget - The total budget for the incentive\n * @returns {Hex}\n */\nexport function prepareCGDAIncentivePayload({\n asset,\n initialReward,\n rewardDecay,\n rewardBoost,\n totalBudget,\n manager,\n}: CGDAIncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'initialReward' },\n { type: 'uint256', name: 'rewardDecay' },\n { type: 'uint256', name: 'rewardBoost' },\n { type: 'uint256', name: 'totalBudget' },\n { type: 'address', name: 'manager' },\n ],\n [asset, initialReward, rewardDecay, rewardBoost, totalBudget, manager],\n );\n}\n"],"names":["_CGDAIncentive","DeployableTarget","cgdaIncentiveAbi","params","readCgdaIncentiveOwner","readCgdaIncentiveClaims","readCgdaIncentiveReward","address","readCgdaIncentiveClaimed","readCgdaIncentiveAsset","rewardDecay","rewardBoost","lastClaimTime","currentReward","readCgdaIncentiveCgdaParams","readCgdaIncentiveTotalBudget","payload","request","result","simulateCgdaIncentiveClaim","prepareClaimPayload","writeCgdaIncentiveClaim","simulateCgdaIncentiveClawback","writeCgdaIncentiveClawback","readCgdaIncentiveIsClaimable","currentBalance","getErc20Balance","readCgdaIncentiveCurrentReward","_a","_payload","_options","options","bytecode","prepareCGDAIncentivePayload","amount","encodeAbiParameters","netAmount","zeroHash","_b","_c","_d","CGDAIncentiveBases","RegistryType","CGDAIncentive","asset","initialReward","totalBudget","manager"],"mappings":"0vcAiJaA,EAAN,MAAMA,UAAsBC,EAAAA,gBAGjC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAAuB,KAAK,QAAS,CAChD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAME,EAAAA,GAAwB,KAAK,QAAS,CACjD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAMG,EAAAA,GAAwB,KAAK,QAAS,CACjD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAWA,MAAa,QAAQI,EAAkBJ,EAAqB,CACnD,OAAA,MAAMK,EAAAA,GAAyB,KAAK,QAAS,CAClD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAACD,CAAO,EAEd,GAAIJ,CAAA,CACL,CACH,CAUA,MAAa,MAAMA,EAAqB,CAC/B,OAAA,MAAMM,EAAAA,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AAW,KAAM,OAAQ,EACjC,CAAE,KAAM,UAAW,KAAM,eAAgB,EACzC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,SAAU,CACrC,EACA,CACG,MAAM,KAAK,MAAA,GAAYE,EAAA,WACxBT,EAAA,KAAK,UAAL,YAAAA,EAAc,gBAAiB,KAC/BU,EAAA,KAAK,UAAL,YAAAA,EAAc,cAAe,KAC7BC,EAAA,KAAK,UAAL,YAAAA,EAAc,cAAe,GAC7BH,IACAI,EAAA,KAAK,UAAL,YAAAA,EAAc,UAAWH,EAAA,QAC3B,CAAA,CAEJ,CASO,gBAAiB,CACf,OAAAA,UACT,CACF,EAhXErC,EAAuB,MAAiC,CACtD,MAAO,OACP,GAAIyC,EAAA,aAAA,EASNzC,EAAuB,aAA6B0C,EAAa,aAAA,UAvB5D,IAAMC,EAAN3C,EAyYA,SAASiC,EAA4B,CAC1C,MAAAW,EACA,cAAAC,EACA,YAAAnC,EACA,YAAAC,EACA,YAAAmC,EACA,QAAAC,CACF,EAAyB,CAChB,OAAAZ,EAAA,oBACL,CACE,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,UAAW,KAAM,eAAgB,EACzC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,aAAc,EACvC,CAAE,KAAM,UAAW,KAAM,SAAU,CACrC,EACA,CAACS,EAAOC,EAAenC,EAAaC,EAAamC,EAAaC,CAAO,CAAA,CAEzE"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cgdaIncentiveAbi } from '@boostxyz/evm';
|
|
2
|
-
import { type Address, type ContractEventName } from 'viem';
|
|
2
|
+
import { type Address, type ContractEventName, type Hex } from 'viem';
|
|
3
3
|
import type { DeployableOptions, GenericDeployableParams } from '../Deployable/Deployable';
|
|
4
4
|
import { DeployableTarget } from '../Deployable/DeployableTarget';
|
|
5
5
|
import { type ClaimPayload } from '../claiming';
|
|
@@ -898,6 +898,17 @@ export declare class CGDAIncentive extends DeployableTarget<CGDAIncentivePayload
|
|
|
898
898
|
* @returns {Hex} - Returns an encoded uint256
|
|
899
899
|
*/
|
|
900
900
|
buildClawbackData(amount: bigint): `0x${string}`;
|
|
901
|
+
/**
|
|
902
|
+
* Generates a top-up payload for the CGDAIncentive contract.
|
|
903
|
+
*
|
|
904
|
+
* In this approach, we treat a "top-up" as incrementing the existing `totalBudget`
|
|
905
|
+
* in the incentive by `netAmount`. The entire payload is re-encoded with the updated budget.
|
|
906
|
+
*
|
|
907
|
+
* @public
|
|
908
|
+
* @param {bigint} netAmount The additional tokens to add to `totalBudget`.
|
|
909
|
+
* @returns {Hex} The ABI-encoded, updated CGDAIncentive payload.
|
|
910
|
+
*/
|
|
911
|
+
getTopupPayload(netAmount: bigint): Promise<Hex>;
|
|
901
912
|
/**
|
|
902
913
|
* Builds the claim data for the CGDAIncentive.
|
|
903
914
|
*
|