@boostxyz/sdk 7.3.0 → 7.5.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 +2 -2
- package/dist/Actions/EventAction.cjs +1 -1
- package/dist/Actions/EventAction.cjs.map +1 -1
- package/dist/Actions/EventAction.d.ts.map +1 -1
- package/dist/Actions/EventAction.js +160 -159
- package/dist/Actions/EventAction.js.map +1 -1
- package/dist/AllowLists/AllowList.cjs +1 -1
- package/dist/AllowLists/AllowList.js +3 -3
- package/dist/AllowLists/SimpleAllowList.cjs +1 -1
- package/dist/AllowLists/SimpleAllowList.cjs.map +1 -1
- package/dist/AllowLists/SimpleAllowList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleAllowList.js +30 -30
- package/dist/AllowLists/SimpleAllowList.js.map +1 -1
- package/dist/AllowLists/SimpleDenyList.cjs +1 -1
- package/dist/AllowLists/SimpleDenyList.d.ts.map +1 -1
- package/dist/AllowLists/SimpleDenyList.js +3 -3
- package/dist/Auth/PassthroughAuth.cjs +1 -1
- package/dist/Auth/PassthroughAuth.js +1 -1
- package/dist/BoostCore.cjs +2 -2
- package/dist/BoostCore.cjs.map +1 -1
- package/dist/BoostCore.d.ts +14 -0
- package/dist/BoostCore.d.ts.map +1 -1
- package/dist/BoostCore.js +199 -180
- package/dist/BoostCore.js.map +1 -1
- package/dist/BoostRegistry.cjs +1 -1
- package/dist/BoostRegistry.cjs.map +1 -1
- package/dist/BoostRegistry.d.ts.map +1 -1
- package/dist/BoostRegistry.js +31 -31
- package/dist/BoostRegistry.js.map +1 -1
- package/dist/Budget-DGg1wCa6.cjs +2 -0
- package/dist/Budget-DGg1wCa6.cjs.map +1 -0
- package/dist/{Budget-B-grnRq9.js → Budget-ZnzzZsjK.js} +102 -102
- package/dist/Budget-ZnzzZsjK.js.map +1 -0
- package/dist/Budgets/Budget.cjs +1 -1
- package/dist/Budgets/Budget.js +3 -3
- package/dist/Budgets/ManagedBudget.cjs +1 -1
- package/dist/Budgets/ManagedBudget.cjs.map +1 -1
- package/dist/Budgets/ManagedBudget.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudget.js +48 -48
- package/dist/Budgets/ManagedBudget.js.map +1 -1
- package/dist/Budgets/ManagedBudgetWithFees.d.ts.map +1 -1
- package/dist/Budgets/ManagedBudgetWithFeesV2.d.ts.map +1 -1
- package/dist/Budgets/TransparentBudget.d.ts.map +1 -1
- package/dist/Budgets/VestingBudget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.cjs +1 -1
- package/dist/Deployable/DeployableTarget.cjs.map +1 -1
- package/dist/Deployable/DeployableTarget.d.ts.map +1 -1
- package/dist/Deployable/DeployableTarget.js +5 -8
- package/dist/Deployable/DeployableTarget.js.map +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.cjs +1 -1
- package/dist/Deployable/DeployableTargetWithRBAC.js +19 -19
- package/dist/{Incentive-Bz_g-nID.js → Incentive-CYj6lbM5.js} +64 -64
- package/dist/Incentive-CYj6lbM5.js.map +1 -0
- package/dist/{Incentive-Dufx0ZjH.cjs → Incentive-Ckxpw7EN.cjs} +2 -2
- package/dist/Incentive-Ckxpw7EN.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.map +1 -1
- package/dist/Incentives/AllowListIncentive.js +36 -36
- 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.map +1 -1
- package/dist/Incentives/CGDAIncentive.js +37 -37
- package/dist/Incentives/CGDAIncentive.js.map +1 -1
- package/dist/Incentives/ERC1155Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.cjs +1 -1
- package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
- package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20Incentive.js +44 -44
- package/dist/Incentives/ERC20Incentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js +63 -63
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js +55 -53
- package/dist/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js +45 -45
- package/dist/Incentives/ERC20VariableCriteriaIncentive.js.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.cjs.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.d.ts.map +1 -1
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.js +51 -49
- package/dist/Incentives/ERC20VariableCriteriaIncentiveV2.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.map +1 -1
- package/dist/Incentives/ERC20VariableIncentive.js +38 -38
- package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
- package/dist/Incentives/Incentive.cjs +1 -1
- package/dist/Incentives/Incentive.js +3 -3
- package/dist/Incentives/PointsIncentive.cjs +1 -1
- package/dist/Incentives/PointsIncentive.cjs.map +1 -1
- package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
- package/dist/Incentives/PointsIncentive.js +35 -35
- package/dist/Incentives/PointsIncentive.js.map +1 -1
- package/dist/{SimpleDenyList-BlLgvhjE.js → SimpleDenyList-DUO4ex__.js} +32 -32
- package/dist/SimpleDenyList-DUO4ex__.js.map +1 -0
- package/dist/{SimpleDenyList-B2YDJ_gk.cjs → SimpleDenyList-v5G-fPfm.cjs} +2 -2
- package/dist/SimpleDenyList-v5G-fPfm.cjs.map +1 -0
- package/dist/Validator-BA8RC2J6.cjs +2 -0
- package/dist/Validator-BA8RC2J6.cjs.map +1 -0
- package/dist/Validator-D4CzwdB9.js +409 -0
- package/dist/Validator-D4CzwdB9.js.map +1 -0
- package/dist/Validators/LimitedSignerValidator.cjs +1 -1
- package/dist/Validators/LimitedSignerValidator.cjs.map +1 -1
- package/dist/Validators/LimitedSignerValidator.d.ts.map +1 -1
- package/dist/Validators/LimitedSignerValidator.js +39 -39
- package/dist/Validators/LimitedSignerValidator.js.map +1 -1
- package/dist/Validators/PayableLimitedSignerValidator.d.ts +829 -0
- package/dist/Validators/PayableLimitedSignerValidator.d.ts.map +1 -0
- package/dist/Validators/SignerValidator.cjs +1 -1
- package/dist/Validators/SignerValidator.cjs.map +1 -1
- package/dist/Validators/SignerValidator.d.ts.map +1 -1
- package/dist/Validators/SignerValidator.js +48 -48
- package/dist/Validators/SignerValidator.js.map +1 -1
- package/dist/Validators/Validator.cjs +1 -1
- package/dist/Validators/Validator.cjs.map +1 -1
- package/dist/Validators/Validator.d.ts +4 -3
- package/dist/Validators/Validator.d.ts.map +1 -1
- package/dist/Validators/Validator.js +14 -50
- package/dist/Validators/Validator.js.map +1 -1
- package/dist/componentInterfaces-D4QdH2Qz.cjs +2 -0
- package/dist/componentInterfaces-D4QdH2Qz.cjs.map +1 -0
- package/dist/componentInterfaces-DCTot4_O.js +24 -0
- package/dist/componentInterfaces-DCTot4_O.js.map +1 -0
- package/dist/{deployments-DKtAq6BT.js → deployments-B-ZU0zVY.js} +61 -34
- package/dist/{deployments-DKtAq6BT.js.map → deployments-B-ZU0zVY.js.map} +1 -1
- package/dist/deployments-CaacquP1.cjs +2 -0
- package/dist/deployments-CaacquP1.cjs.map +1 -0
- package/dist/deployments.json +32 -4
- package/dist/generated-BOBQ2ut4.cjs +3 -0
- package/dist/generated-BOBQ2ut4.cjs.map +1 -0
- package/dist/{generated-CINzoGbl.js → generated-ffteMTHN.js} +1157 -776
- package/dist/generated-ffteMTHN.js.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +123 -118
- package/package.json +1 -1
- package/src/Actions/EventAction.ts +3 -1
- package/src/AllowLists/SimpleAllowList.ts +3 -1
- package/src/AllowLists/SimpleDenyList.ts +3 -1
- package/src/BoostCore.ts +30 -1
- package/src/BoostRegistry.ts +3 -1
- package/src/Budgets/ManagedBudget.ts +3 -1
- package/src/Budgets/ManagedBudgetWithFees.ts +3 -1
- package/src/Budgets/ManagedBudgetWithFeesV2.ts +3 -1
- package/src/Budgets/TransparentBudget.ts +3 -1
- package/src/Budgets/VestingBudget.ts +3 -1
- package/src/Deployable/DeployableTarget.ts +2 -3
- package/src/Incentives/AllowListIncentive.ts +3 -1
- package/src/Incentives/CGDAIncentive.ts +3 -1
- package/src/Incentives/ERC1155Incentive.ts +3 -1
- package/src/Incentives/ERC20Incentive.ts +3 -1
- package/src/Incentives/ERC20PeggedIncentive.ts +3 -1
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentive.ts +3 -1
- package/src/Incentives/ERC20PeggedVariableCriteriaIncentiveV2.ts +6 -2
- package/src/Incentives/ERC20VariableCriteriaIncentive.ts +3 -1
- package/src/Incentives/ERC20VariableCriteriaIncentiveV2.ts +5 -1
- package/src/Incentives/ERC20VariableIncentive.ts +3 -1
- package/src/Incentives/PointsIncentive.ts +3 -1
- package/src/Validators/LimitedSignerValidator.ts +3 -1
- package/src/Validators/PayableLimitedSignerValidator.test.ts +202 -0
- package/src/Validators/PayableLimitedSignerValidator.ts +667 -0
- package/src/Validators/SignerValidator.ts +3 -1
- package/src/Validators/Validator.ts +7 -1
- package/src/index.ts +1 -0
- package/dist/Budget-B-grnRq9.js.map +0 -1
- package/dist/Budget-uGKa2qzz.cjs +0 -2
- package/dist/Budget-uGKa2qzz.cjs.map +0 -1
- package/dist/Incentive-Bz_g-nID.js.map +0 -1
- package/dist/Incentive-Dufx0ZjH.cjs.map +0 -1
- package/dist/SimpleDenyList-B2YDJ_gk.cjs.map +0 -1
- package/dist/SimpleDenyList-BlLgvhjE.js.map +0 -1
- package/dist/componentInterfaces-C5ig8mCK.cjs +0 -2
- package/dist/componentInterfaces-C5ig8mCK.cjs.map +0 -1
- package/dist/componentInterfaces-Ddus5rIA.js +0 -23
- package/dist/componentInterfaces-Ddus5rIA.js.map +0 -1
- package/dist/deployments-Dk-Z1L2X.cjs +0 -2
- package/dist/deployments-Dk-Z1L2X.cjs.map +0 -1
- package/dist/generated-CINzoGbl.js.map +0 -1
- package/dist/generated-C_JEoLDO.cjs +0 -3
- package/dist/generated-C_JEoLDO.cjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../generated-C_JEoLDO.cjs"),m=require("@wagmi/core"),t=require("viem"),w=require("../deployments-Dk-Z1L2X.cjs"),l=require("../Actions/EventAction.cjs"),c=require("../errors.cjs"),E=require("../utils.cjs"),C=require("./ERC20VariableIncentive.cjs"),I="0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6120aa806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b14610703578063fe9fbb8014610716578063fee81cf414610735575f80fd5b8063ec87621c146106dc578063f04e283e146106f0575f80fd5b8063db09da12116100ac578063db09da1214610689578063dcc21361146106a8578063dcc59b6f146106c7575f80fd5b8063c884ef8314610646578063d54ad2a114610674575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf146105f4578063be4994f814610613578063c213f3f914610632575f80fd5b8063a4d66daf146105be578063a871ced2146105d3575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105a6575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a61029536600461180a565b610766565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611850565b6107c1565b005b6102df6102ef366004611888565b6107ce565b3480156102ff575f80fd5b5061029a61030e366004611888565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df6107e4565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be6103993660046118b2565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611850565b610831565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a366004611915565b6108ed565b34801561044a575f80fd5b506102df6104593660046119bf565b6109e7565b348015610469575f80fd5b5061047d6104783660046119bf565b610cd1565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b5366004611888565b610e33565b3480156104c5575f80fd5b506104d96104d43660046119bf565b610e45565b6040516102a69190611a4a565b3480156104f1575f80fd5b5061029a610500366004611888565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610f2e565b34801561052e575f80fd5b506102be60065481565b6102df610f67565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105969260ff908116929190811690610100900473ffffffffffffffffffffffffffffffffffffffff1684565b6040516102a69493929190611a9d565b3480156105b1575f80fd5b50638b78c6d819546103fb565b3480156105c9575f80fd5b506102be60025481565b3480156105de575f80fd5b506105e7610f7a565b6040516102a69190611b25565b3480156105ff575f80fd5b5061029a61060e366004611b33565b611014565b34801561061e575f80fd5b506102df61062d366004611915565b611245565b34801561063d575f80fd5b506006546102be565b348015610651575f80fd5b5061029a6106603660046118b2565b60016020525f908152604090205460ff1681565b34801561067f575f80fd5b506102be60055481565b348015610694575f80fd5b5061029a6106a3366004611b33565b6112e3565b3480156106b3575f80fd5b506102df6106c2366004611915565b6112f9565b3480156106d2575f80fd5b506102be60045481565b3480156106e7575f80fd5b506102be600181565b6102df6106fe3660046118b2565b611397565b6102df6107113660046118b2565b6113d1565b348015610721575f80fd5b5061029a6107303660046118b2565b6113f7565b348015610740575f80fd5b506102be61074f3660046118b2565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611456565b92915050565b6107cb33826114ab565b50565b6107d66114b6565b6107e082826114d0565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b600161083c816114dc565b815f03610875576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035461089a9073ffffffffffffffffffffffffffffffffffffffff1633308561150d565b8160025f8282546108ab9190611bb1565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b60026108f8816114dc565b838214610931576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df575f84848381811061094e5761094e611bc4565b90506020020160208101906109639190611bf1565b90508015156001036109a5576109a087878481811061098457610984611bc4565b905060200201602081019061099991906118b2565b60016114d0565b6109d6565b6109d68787848181106109ba576109ba611bc4565b90506020020160208101906109cf91906118b2565b60016114ab565b50600101610933565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a385760018160011c14303b10610a2f5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a4683850185611cac565b805160208201516040830151606084015160808501519495509293919290915f839003610a9f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610ac073ffffffffffffffffffffffffffffffffffffffff87163061156f565b905083811015610b295786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bba57610bba611a5c565b02179055506020820151600182015560408201516002909101805460609093015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090931660ff90921691909117919091179055610c31336115a2565b610c3c3360016115ea565b8573ffffffffffffffffffffffffffffffffffffffff167f4dfcc2b9ad954a56fe7153ce6568e2d30033d056714ca4acaa4620b12e1a1a2486868686604051610c889493929190611d83565b60405180910390a2505050505050508015610ccc576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cde816114dc565b5f610ceb85870187611e57565b90505f8160200151806020019051810190610d069190611ed6565b90508060025f828254610d199190611eed565b90915550508151600354610d469173ffffffffffffffffffffffffffffffffffffffff909116908361162b565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e0491611a4a565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610e3b6114b6565b6107e082826114ab565b60605f80610e5584860186611f00565b9250509150604051806080016040528060016002811115610e7857610e78611a5c565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610ed79151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f159190602001611f32565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f6f6114b6565b610f785f61167e565b565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810190915260078054829060ff166001811115610fc257610fc2611a5c565b6001811115610fd357610fd3611a5c565b81526001820154602082015260029091015460ff81166040830152610100900473ffffffffffffffffffffffffffffffffffffffff16606090910152919050565b5f61101d6114b6565b5f61102a83850185611fa8565b90505f81602001518060200190518101906110459190611ed6565b90505f6110556002546005541090565b61108b576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f0361109a5750806110bd565b670de0b6b3a7640000825f546110b09190612025565b6110ba919061203c565b90505b600654158015906110cf575060065481115b156110d957506006545b600254816005546110ea9190611bb1565b1115611122576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111339190611bb1565b92505081905550600160045f82825461114c9190611bb1565b90915550506003546111759073ffffffffffffffffffffffffffffffffffffffff16888361162b565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261123091611a4a565b60405180910390a25060019695505050505050565b6002611250816114dc565b838214611289576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df576112db8686838181106112a8576112a8611bc4565b90506020020160208101906112bd91906118b2565b8585848181106112cf576112cf611bc4565b905060200201356114d0565b60010161128b565b5f6112f16002546005541090565b949350505050565b6002611304816114dc565b83821461133d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df5761138f86868381811061135c5761135c611bc4565b905060200201602081019061137191906118b2565b85858481811061138357611383611bc4565b905060200201356114ab565b60010161133f565b61139f6114b6565b63389a75e1600c52805f526020600c2080544211156113c557636f5e88185f526004601cfd5b5f90556107cb8161167e565b6113d96114b6565b8060601b6113ee57637448fbae5f526004601cfd5b6107cb8161167e565b5f8173ffffffffffffffffffffffffffffffffffffffff1661141c638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107bb5750638b78c6d8600c9081525f839052602090205460031615156107bb565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107bb57506107bb826116c8565b6107e082825f61171d565b638b78c6d819543314610f78576382b429005f526004601cfd5b6107e08282600161171d565b638b78c6d8195433146107cb57638b78c6d8600c52335f52806020600c2054166107cb576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661156157803d873b15171061156157637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661167457803d853b151710611674576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611774565b638b78c6d8600c52825f526020600c2080548381178361173e575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107bb565b5f6020828403121561181a575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611849575f80fd5b9392505050565b5f60208284031215611860575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107cb575f80fd5b5f8060408385031215611899575f80fd5b82356118a481611867565b946020939093013593505050565b5f602082840312156118c2575f80fd5b813561184981611867565b5f8083601f8401126118dd575f80fd5b50813567ffffffffffffffff8111156118f4575f80fd5b6020830191508360208260051b850101111561190e575f80fd5b9250929050565b5f805f8060408587031215611928575f80fd5b843567ffffffffffffffff81111561193e575f80fd5b61194a878288016118cd565b909550935050602085013567ffffffffffffffff811115611969575f80fd5b611975878288016118cd565b95989497509550505050565b5f8083601f840112611991575f80fd5b50813567ffffffffffffffff8111156119a8575f80fd5b60208301915083602082850101111561190e575f80fd5b5f80602083850312156119d0575f80fd5b823567ffffffffffffffff8111156119e6575f80fd5b6119f285828601611981565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61184960208301846119fe565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110611a9957611a99611a5c565b9052565b60808101611aab8287611a89565b84602083015260ff8416604083015273ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b611aea828251611a89565b6020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301525050565b608081016107bb8284611adf565b5f805f60408486031215611b45575f80fd5b8335611b5081611867565b9250602084013567ffffffffffffffff811115611b6b575f80fd5b611b7786828701611981565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107bb576107bb611b84565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611c01575f80fd5b81358015158114611849575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611c6057611c60611c10565b60405290565b6040516080810167ffffffffffffffff81118282101715611c6057611c60611c10565b6040805190810167ffffffffffffffff81118282101715611c6057611c60611c10565b5f81830361010081128015611cbf575f80fd5b50611cc8611c3d565b8335611cd381611867565b815260208481013590820152604080850135908201526060808501359082015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611d22575f80fd5b611d2a611c66565b9150608084013560028110611d3d575f80fd5b825260a0840135602083015260c084013560ff81168114611d5c575f80fd5b604083015260e0840135611d6f81611867565b606083015260808101919091529392505050565b848152602081018490526040810183905260e08101611da56060830184611adf565b95945050505050565b5f82601f830112611dbd575f80fd5b813567ffffffffffffffff811115611dd757611dd7611c10565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611e2457611e24611c10565b604052818152838201602001851015611e3b575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611e67575f80fd5b813567ffffffffffffffff811115611e7d575f80fd5b820160408185031215611e8e575f80fd5b611e96611c89565b8135611ea181611867565b8152602082013567ffffffffffffffff811115611ebc575f80fd5b611ec886828501611dae565b602083015250949350505050565b5f60208284031215611ee6575f80fd5b5051919050565b818103818111156107bb576107bb611b84565b5f805f60608486031215611f12575f80fd5b8335611f1d81611867565b95602085013595506040909401359392505050565b602081525f825160038110611f4957611f49611a5c565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526112f160a08401826119fe565b5f60208284031215611fb8575f80fd5b813567ffffffffffffffff811115611fce575f80fd5b820160408185031215611fdf575f80fd5b611fe7611c89565b813567ffffffffffffffff811115611ffd575f80fd5b61200986828501611dae565b825250602082013567ffffffffffffffff811115611ebc575f80fd5b80820281158282048414176107bb576107bb611b84565b5f8261206f577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122002cb02f574ade708d1d5aab7fb7184f2ca850079b21767cde9fb97481599ce8d64736f6c634300081a0033",p=class p extends C.ERC20VariableIncentive{constructor(){super(...arguments),this.abi=u.c}async getIncentiveCriteria(e){try{return await u.uE(this._config,{...e,address:this.assertValidAddress()})}catch(a){throw new c.IncentiveCriteriaNotFoundError(a)}}async decodeClaimData(e){const a=t.decodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],e),d=t.decodeAbiParameters([{type:"uint256"}],a[0].incentiveData)[0];let b=d;const[f,i]=await Promise.all([this.reward(),this.getMaxReward()]);return f===0n||(b=f*d/t.parseEther("1"),i!==0n&&b>i&&(b=i)),b}async getMaxReward(e){return await u.lE(this._config,{...e,address:this.assertValidAddress()})}async getIncentiveScalar({chainId:e,hash:a,knownSignatures:d},b){var i;const f=await this.getIncentiveCriteria(b);if(f.criteriaType===l.SignatureType.EVENT){const r=await m.getTransactionReceipt(this._config,{chainId:e,hash:a});if(f.fieldIndex===E.CheatCodes.GAS_REBATE_INCENTIVE)return r.gasUsed*r.effectiveGasPrice+(r.blobGasUsed??0n)*(r.blobGasPrice??0n);const s=r.logs;if(s.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);try{const o=d[f.signature],n=t.parseEventLogs({abi:[o],logs:s});if(n==null||n.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);const y=((i=n[0])==null?void 0:i.args)[f.fieldIndex];if(y===void 0)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(y)}catch(o){throw new c.DecodedArgsError(`Failed to decode event log for signature ${f.signature}: ${o.message}`)}}else if(f.criteriaType===l.SignatureType.FUNC){const r=await m.getTransaction(this._config,{chainId:e,hash:a});try{const s=d[f.signature],n=t.decodeFunctionData({abi:[s],data:r.input}).args[f.fieldIndex];if(n==null)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(n)}catch(s){throw new c.DecodedArgsError(`Failed to decode function data for signature ${f.signature}: ${s.message}`)}}else throw new c.InvalidCriteriaTypeError(`Invalid criteria type ${f.criteriaType}`)}buildParameters(e,a){const[d,b]=this.validateDeploymentConfig(e,a);return{abi:u.c,bytecode:I,args:[h(d)],...this.optionallyAttachAccount(b.account)}}};p.bases={31337:void 0,...w.ERC20VariableCriteriaIncentive};let g=p;function A(){return{criteriaType:l.SignatureType.EVENT,signature:t.zeroHash,fieldIndex:E.CheatCodes.GAS_REBATE_INCENTIVE,targetContract:t.zeroAddress}}function h({asset:v,reward:e,limit:a,maxReward:d=0n,criteria:b}){return t.encodeAbiParameters([{type:"tuple",name:"initPayloadExtended",components:[{type:"address",name:"asset"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"uint256",name:"maxReward"},{type:"tuple",name:"criteria",components:[{type:"uint8",name:"criteriaType"},{type:"bytes32",name:"signature"},{type:"uint8",name:"fieldIndex"},{type:"address",name:"targetContract"}]}]}],[{asset:v,reward:e,limit:a,maxReward:d,criteria:{criteriaType:b.criteriaType,signature:b.signature,fieldIndex:b.fieldIndex,targetContract:b.targetContract}}])}exports.erc20VariableCriteriaIncentiveAbi=u.c;exports.ERC20VariableCriteriaIncentive=g;exports.gasRebateIncentiveCriteria=A;exports.prepareERC20VariableCriteriaIncentivePayload=h;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("../generated-BOBQ2ut4.cjs"),m=require("@wagmi/core"),t=require("viem"),h=require("../deployments-CaacquP1.cjs"),g=require("../Actions/EventAction.cjs"),c=require("../errors.cjs"),I=require("../utils.cjs"),w=require("./ERC20VariableIncentive.cjs"),A="0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6120aa806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b14610703578063fe9fbb8014610716578063fee81cf414610735575f80fd5b8063ec87621c146106dc578063f04e283e146106f0575f80fd5b8063db09da12116100ac578063db09da1214610689578063dcc21361146106a8578063dcc59b6f146106c7575f80fd5b8063c884ef8314610646578063d54ad2a114610674575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf146105f4578063be4994f814610613578063c213f3f914610632575f80fd5b8063a4d66daf146105be578063a871ced2146105d3575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105a6575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a61029536600461180a565b610766565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611850565b6107c1565b005b6102df6102ef366004611888565b6107ce565b3480156102ff575f80fd5b5061029a61030e366004611888565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df6107e4565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be6103993660046118b2565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611850565b610831565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a366004611915565b6108ed565b34801561044a575f80fd5b506102df6104593660046119bf565b6109e7565b348015610469575f80fd5b5061047d6104783660046119bf565b610cd1565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b5366004611888565b610e33565b3480156104c5575f80fd5b506104d96104d43660046119bf565b610e45565b6040516102a69190611a4a565b3480156104f1575f80fd5b5061029a610500366004611888565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610f2e565b34801561052e575f80fd5b506102be60065481565b6102df610f67565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105969260ff908116929190811690610100900473ffffffffffffffffffffffffffffffffffffffff1684565b6040516102a69493929190611a9d565b3480156105b1575f80fd5b50638b78c6d819546103fb565b3480156105c9575f80fd5b506102be60025481565b3480156105de575f80fd5b506105e7610f7a565b6040516102a69190611b25565b3480156105ff575f80fd5b5061029a61060e366004611b33565b611014565b34801561061e575f80fd5b506102df61062d366004611915565b611245565b34801561063d575f80fd5b506006546102be565b348015610651575f80fd5b5061029a6106603660046118b2565b60016020525f908152604090205460ff1681565b34801561067f575f80fd5b506102be60055481565b348015610694575f80fd5b5061029a6106a3366004611b33565b6112e3565b3480156106b3575f80fd5b506102df6106c2366004611915565b6112f9565b3480156106d2575f80fd5b506102be60045481565b3480156106e7575f80fd5b506102be600181565b6102df6106fe3660046118b2565b611397565b6102df6107113660046118b2565b6113d1565b348015610721575f80fd5b5061029a6107303660046118b2565b6113f7565b348015610740575f80fd5b506102be61074f3660046118b2565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611456565b92915050565b6107cb33826114ab565b50565b6107d66114b6565b6107e082826114d0565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b600161083c816114dc565b815f03610875576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035461089a9073ffffffffffffffffffffffffffffffffffffffff1633308561150d565b8160025f8282546108ab9190611bb1565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b60026108f8816114dc565b838214610931576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df575f84848381811061094e5761094e611bc4565b90506020020160208101906109639190611bf1565b90508015156001036109a5576109a087878481811061098457610984611bc4565b905060200201602081019061099991906118b2565b60016114d0565b6109d6565b6109d68787848181106109ba576109ba611bc4565b90506020020160208101906109cf91906118b2565b60016114ab565b50600101610933565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a385760018160011c14303b10610a2f5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a4683850185611cac565b805160208201516040830151606084015160808501519495509293919290915f839003610a9f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610ac073ffffffffffffffffffffffffffffffffffffffff87163061156f565b905083811015610b295786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bba57610bba611a5c565b02179055506020820151600182015560408201516002909101805460609093015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090931660ff90921691909117919091179055610c31336115a2565b610c3c3360016115ea565b8573ffffffffffffffffffffffffffffffffffffffff167f4dfcc2b9ad954a56fe7153ce6568e2d30033d056714ca4acaa4620b12e1a1a2486868686604051610c889493929190611d83565b60405180910390a2505050505050508015610ccc576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cde816114dc565b5f610ceb85870187611e57565b90505f8160200151806020019051810190610d069190611ed6565b90508060025f828254610d199190611eed565b90915550508151600354610d469173ffffffffffffffffffffffffffffffffffffffff909116908361162b565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e0491611a4a565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610e3b6114b6565b6107e082826114ab565b60605f80610e5584860186611f00565b9250509150604051806080016040528060016002811115610e7857610e78611a5c565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610ed79151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f159190602001611f32565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f6f6114b6565b610f785f61167e565b565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810190915260078054829060ff166001811115610fc257610fc2611a5c565b6001811115610fd357610fd3611a5c565b81526001820154602082015260029091015460ff81166040830152610100900473ffffffffffffffffffffffffffffffffffffffff16606090910152919050565b5f61101d6114b6565b5f61102a83850185611fa8565b90505f81602001518060200190518101906110459190611ed6565b90505f6110556002546005541090565b61108b576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f0361109a5750806110bd565b670de0b6b3a7640000825f546110b09190612025565b6110ba919061203c565b90505b600654158015906110cf575060065481115b156110d957506006545b600254816005546110ea9190611bb1565b1115611122576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111339190611bb1565b92505081905550600160045f82825461114c9190611bb1565b90915550506003546111759073ffffffffffffffffffffffffffffffffffffffff16888361162b565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261123091611a4a565b60405180910390a25060019695505050505050565b6002611250816114dc565b838214611289576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df576112db8686838181106112a8576112a8611bc4565b90506020020160208101906112bd91906118b2565b8585848181106112cf576112cf611bc4565b905060200201356114d0565b60010161128b565b5f6112f16002546005541090565b949350505050565b6002611304816114dc565b83821461133d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df5761138f86868381811061135c5761135c611bc4565b905060200201602081019061137191906118b2565b85858481811061138357611383611bc4565b905060200201356114ab565b60010161133f565b61139f6114b6565b63389a75e1600c52805f526020600c2080544211156113c557636f5e88185f526004601cfd5b5f90556107cb8161167e565b6113d96114b6565b8060601b6113ee57637448fbae5f526004601cfd5b6107cb8161167e565b5f8173ffffffffffffffffffffffffffffffffffffffff1661141c638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107bb5750638b78c6d8600c9081525f839052602090205460031615156107bb565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107bb57506107bb826116c8565b6107e082825f61171d565b638b78c6d819543314610f78576382b429005f526004601cfd5b6107e08282600161171d565b638b78c6d8195433146107cb57638b78c6d8600c52335f52806020600c2054166107cb576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661156157803d873b15171061156157637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661167457803d853b151710611674576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611774565b638b78c6d8600c52825f526020600c2080548381178361173e575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107bb565b5f6020828403121561181a575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611849575f80fd5b9392505050565b5f60208284031215611860575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107cb575f80fd5b5f8060408385031215611899575f80fd5b82356118a481611867565b946020939093013593505050565b5f602082840312156118c2575f80fd5b813561184981611867565b5f8083601f8401126118dd575f80fd5b50813567ffffffffffffffff8111156118f4575f80fd5b6020830191508360208260051b850101111561190e575f80fd5b9250929050565b5f805f8060408587031215611928575f80fd5b843567ffffffffffffffff81111561193e575f80fd5b61194a878288016118cd565b909550935050602085013567ffffffffffffffff811115611969575f80fd5b611975878288016118cd565b95989497509550505050565b5f8083601f840112611991575f80fd5b50813567ffffffffffffffff8111156119a8575f80fd5b60208301915083602082850101111561190e575f80fd5b5f80602083850312156119d0575f80fd5b823567ffffffffffffffff8111156119e6575f80fd5b6119f285828601611981565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61184960208301846119fe565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110611a9957611a99611a5c565b9052565b60808101611aab8287611a89565b84602083015260ff8416604083015273ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b611aea828251611a89565b6020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301525050565b608081016107bb8284611adf565b5f805f60408486031215611b45575f80fd5b8335611b5081611867565b9250602084013567ffffffffffffffff811115611b6b575f80fd5b611b7786828701611981565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107bb576107bb611b84565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611c01575f80fd5b81358015158114611849575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611c6057611c60611c10565b60405290565b6040516080810167ffffffffffffffff81118282101715611c6057611c60611c10565b6040805190810167ffffffffffffffff81118282101715611c6057611c60611c10565b5f81830361010081128015611cbf575f80fd5b50611cc8611c3d565b8335611cd381611867565b815260208481013590820152604080850135908201526060808501359082015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611d22575f80fd5b611d2a611c66565b9150608084013560028110611d3d575f80fd5b825260a0840135602083015260c084013560ff81168114611d5c575f80fd5b604083015260e0840135611d6f81611867565b606083015260808101919091529392505050565b848152602081018490526040810183905260e08101611da56060830184611adf565b95945050505050565b5f82601f830112611dbd575f80fd5b813567ffffffffffffffff811115611dd757611dd7611c10565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611e2457611e24611c10565b604052818152838201602001851015611e3b575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611e67575f80fd5b813567ffffffffffffffff811115611e7d575f80fd5b820160408185031215611e8e575f80fd5b611e96611c89565b8135611ea181611867565b8152602082013567ffffffffffffffff811115611ebc575f80fd5b611ec886828501611dae565b602083015250949350505050565b5f60208284031215611ee6575f80fd5b5051919050565b818103818111156107bb576107bb611b84565b5f805f60608486031215611f12575f80fd5b8335611f1d81611867565b95602085013595506040909401359392505050565b602081525f825160038110611f4957611f49611a5c565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526112f160a08401826119fe565b5f60208284031215611fb8575f80fd5b813567ffffffffffffffff811115611fce575f80fd5b820160408185031215611fdf575f80fd5b611fe7611c89565b813567ffffffffffffffff811115611ffd575f80fd5b61200986828501611dae565b825250602082013567ffffffffffffffff811115611ebc575f80fd5b80820281158282048414176107bb576107bb611b84565b5f8261206f577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122002cb02f574ade708d1d5aab7fb7184f2ca850079b21767cde9fb97481599ce8d64736f6c634300081a0033",l={BASE_URL:"/",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_BOOST_MAINNET_SIGNER_EOA:"0xCBD0C302040bC803B4B2EDaF21Be0e49Deff5480",VITE_BOOST_TESTNET_SIGNER_EOA:"0xd63167e9db11B108940b2E8236581F961f33f396"},p=class p extends w.ERC20VariableIncentive{constructor(){super(...arguments),this.abi=u.c}async getIncentiveCriteria(e){try{return await u.HE(this._config,{...e,address:this.assertValidAddress()})}catch(a){throw new c.IncentiveCriteriaNotFoundError(a)}}async decodeClaimData(e){const a=t.decodeAbiParameters([{type:"tuple",name:"BoostClaimData",components:[{type:"bytes",name:"validatorData"},{type:"bytes",name:"incentiveData"}]}],e),d=t.decodeAbiParameters([{type:"uint256"}],a[0].incentiveData)[0];let b=d;const[f,i]=await Promise.all([this.reward(),this.getMaxReward()]);return f===0n||(b=f*d/t.parseEther("1"),i!==0n&&b>i&&(b=i)),b}async getMaxReward(e){return await u.xE(this._config,{...e,address:this.assertValidAddress()})}async getIncentiveScalar({chainId:e,hash:a,knownSignatures:d},b){var i;const f=await this.getIncentiveCriteria(b);if(f.criteriaType===g.SignatureType.EVENT){const r=await m.getTransactionReceipt(this._config,{chainId:e,hash:a});if(f.fieldIndex===I.CheatCodes.GAS_REBATE_INCENTIVE)return r.gasUsed*r.effectiveGasPrice+(r.blobGasUsed??0n)*(r.blobGasPrice??0n);const s=r.logs;if(s.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);try{const o=d[f.signature],n=t.parseEventLogs({abi:[o],logs:s});if(n==null||n.length===0)throw new c.NoMatchingLogsError(`No logs found for event signature ${f.signature}`);const y=((i=n[0])==null?void 0:i.args)[f.fieldIndex];if(y===void 0)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(y)}catch(o){throw new c.DecodedArgsError(`Failed to decode event log for signature ${f.signature}: ${o.message}`)}}else if(f.criteriaType===g.SignatureType.FUNC){const r=await m.getTransaction(this._config,{chainId:e,hash:a});try{const s=d[f.signature],n=t.decodeFunctionData({abi:[s],data:r.input}).args[f.fieldIndex];if(n==null)throw new c.DecodedArgsError(`Decoded argument at index ${f.fieldIndex} is undefined`);return BigInt(n)}catch(s){throw new c.DecodedArgsError(`Failed to decode function data for signature ${f.signature}: ${s.message}`)}}else throw new c.InvalidCriteriaTypeError(`Invalid criteria type ${f.criteriaType}`)}buildParameters(e,a){const[d,b]=this.validateDeploymentConfig(e,a);return{abi:u.c,bytecode:A,args:[C(d)],...this.optionallyAttachAccount(b.account)}}};p.bases={...l!=null&&l.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE?{31337:void 0}:{},...h.ERC20VariableCriteriaIncentive};let E=p;function v(){return{criteriaType:g.SignatureType.EVENT,signature:t.zeroHash,fieldIndex:I.CheatCodes.GAS_REBATE_INCENTIVE,targetContract:t.zeroAddress}}function C({asset:T,reward:e,limit:a,maxReward:d=0n,criteria:b}){return t.encodeAbiParameters([{type:"tuple",name:"initPayloadExtended",components:[{type:"address",name:"asset"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"uint256",name:"maxReward"},{type:"tuple",name:"criteria",components:[{type:"uint8",name:"criteriaType"},{type:"bytes32",name:"signature"},{type:"uint8",name:"fieldIndex"},{type:"address",name:"targetContract"}]}]}],[{asset:T,reward:e,limit:a,maxReward:d,criteria:{criteriaType:b.criteriaType,signature:b.signature,fieldIndex:b.fieldIndex,targetContract:b.targetContract}}])}exports.erc20VariableCriteriaIncentiveAbi=u.c;exports.ERC20VariableCriteriaIncentive=E;exports.gasRebateIncentiveCriteria=v;exports.prepareERC20VariableCriteriaIncentivePayload=C;
|
|
2
2
|
//# sourceMappingURL=ERC20VariableCriteriaIncentive.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ERC20VariableCriteriaIncentive.cjs","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveAbi,\n readErc20VariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveGetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentive as ERC20VariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveAbi };\n\nexport interface ERC20VariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\nexport interface IncentiveCriteria {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n}\n\nexport interface ReadIncentiveCriteriaParams extends ReadParams {}\n\nexport interface GetIncentiveScalarParams {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @deprecated Please use only v2 implementations\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentive}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentivePayload, typeof erc20VariableCriteriaIncentiveAbi>}\n */\nexport class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentivePayload,\n typeof erc20VariableCriteriaIncentiveAbi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE,\n ...(ERC20VariableCriteriaIncentiveBases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveGetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteria(): IncentiveCriteria {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentivePayload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentive","ERC20VariableIncentive","erc20VariableCriteriaIncentiveAbi","params","readErc20VariableCriteriaIncentiveGetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentivePayload","ERC20VariableCriteriaIncentiveBases","ERC20VariableCriteriaIncentive","gasRebateIncentiveCriteria","zeroHash","zeroAddress","asset","limit","encodeAbiParameters"],"mappings":"q8hBAmHaA,EAAN,MAAMA,UAAuCC,EAAAA,sBAIlD,CAJK,aAAA,CAAA,MAAA,GAAA,SAAA,EAML,KAAyB,IAAMC,GAAA,CAwB/B,MAAa,qBACXC,EAC4B,CACxB,GAAA,CAUK,OARL,MAAMC,EAAA,GACJ,KAAK,QACL,CACE,GAAGD,EACH,QAAS,KAAK,mBAAmB,CACnC,CAAA,QAIGE,EAAG,CACJ,MAAA,IAAIC,EAAAA,+BAA+BD,CAAU,CACrD,CACF,CAUA,MAAsB,gBAAgBE,EAAgB,CACpD,MAAMC,EAAiBC,EAAA,oBACrB,CACE,CACE,KAAM,QACN,KAAM,iBACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,eAAgB,EACvC,CAAE,KAAM,QAAS,KAAM,eAAgB,CACzC,CACF,CACF,EACAF,CAAA,EAEIG,EAAeD,EAAA,oBACnB,CAAC,CAAE,KAAM,UAAW,EACpBD,EAAe,CAAC,EAAE,eAClB,CAAC,EACH,IAAIG,EAAcD,EAClB,KAAM,CAACE,EAAQC,CAAS,EAAI,MAAM,QAAQ,IAAI,CAC5C,KAAK,OAAO,EACZ,KAAK,aAAa,CAAA,CACnB,EAED,OAAID,IAAW,KAGED,EAAAC,EAASF,EAAgBI,EAAA,WAAW,GAAG,EAGpDD,IAAc,IAAMF,EAAcE,IACtBF,EAAAE,IAGTF,CACT,CASA,MAAa,aAAaR,EAAsC,CASvD,OARW,MAAMY,EAAA,GACtB,KAAK,QAC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ACV,CAAE,KAAM,QAAS,KAAM,cAAe,EACtC,CAAE,KAAM,UAAW,KAAM,WAAY,EACrC,CAAE,KAAM,QAAS,KAAM,YAAa,EACpC,CAAE,KAAM,UAAW,KAAM,gBAAiB,CAC5C,CACF,CACF,CACF,CACF,EACA,CACE,CACE,MAAAF,EACA,OAAApC,EACA,MAAAqC,EACA,UAAApC,EACA,SAAU,CACR,aAAcM,EAAS,aACvB,UAAWA,EAAS,UACpB,WAAYA,EAAS,WACrB,eAAgBA,EAAS,cAC3B,CACF,CACF,CAAA,CAEJ"}
|
|
1
|
+
{"version":3,"file":"ERC20VariableCriteriaIncentive.cjs","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveAbi,\n readErc20VariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveGetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentive as ERC20VariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveAbi };\n\nexport interface ERC20VariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\nexport interface IncentiveCriteria {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n}\n\nexport interface ReadIncentiveCriteriaParams extends ReadParams {}\n\nexport interface GetIncentiveScalarParams {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @deprecated Please use only v2 implementations\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentive}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentivePayload, typeof erc20VariableCriteriaIncentiveAbi>}\n */\nexport class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentivePayload,\n typeof erc20VariableCriteriaIncentiveAbi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(import.meta.env?.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE\n ? { 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE }\n : {}),\n ...(ERC20VariableCriteriaIncentiveBases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveGetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteria(): IncentiveCriteria {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentivePayload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentive","ERC20VariableIncentive","erc20VariableCriteriaIncentiveAbi","params","readErc20VariableCriteriaIncentiveGetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentivePayload","__vite_import_meta_env__","ERC20VariableCriteriaIncentiveBases","ERC20VariableCriteriaIncentive","gasRebateIncentiveCriteria","zeroHash","zeroAddress","asset","limit","encodeAbiParameters"],"mappings":"opiBAmHaA,EAAN,MAAMA,UAAuCC,EAAAA,sBAIlD,CAJK,aAAA,CAAA,MAAA,GAAA,SAAA,EAML,KAAyB,IAAMC,GAAA,CA0B/B,MAAa,qBACXC,EAC4B,CACxB,GAAA,CAUK,OARL,MAAMC,EAAA,GACJ,KAAK,QACL,CACE,GAAGD,EACH,QAAS,KAAK,mBAAmB,CACnC,CAAA,QAIGE,EAAG,CACJ,MAAA,IAAIC,EAAAA,+BAA+BD,CAAU,CACrD,CACF,CAUA,MAAsB,gBAAgBE,EAAgB,CACpD,MAAMC,EAAiBC,EAAA,oBACrB,CACE,CACE,KAAM,QACN,KAAM,iBACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,eAAgB,EACvC,CAAE,KAAM,QAAS,KAAM,eAAgB,CACzC,CACF,CACF,EACAF,CAAA,EAEIG,EAAeD,EAAA,oBACnB,CAAC,CAAE,KAAM,UAAW,EACpBD,EAAe,CAAC,EAAE,eAClB,CAAC,EACH,IAAIG,EAAcD,EAClB,KAAM,CAACE,EAAQC,CAAS,EAAI,MAAM,QAAQ,IAAI,CAC5C,KAAK,OAAO,EACZ,KAAK,aAAa,CAAA,CACnB,EAED,OAAID,IAAW,KAGED,EAAAC,EAASF,EAAgBI,EAAA,WAAW,GAAG,EAGpDD,IAAc,IAAMF,EAAcE,IACtBF,EAAAE,IAGTF,CACT,CAS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EAClC,CAAE,KAAM,UAAW,KAAM,OAAQ,EACjC,CAAE,KAAM,UAAW,KAAM,WAAY,EACrC,CACE,KAAM,QACN,KAAM,WACN,WAAY,CACV,CAAE,KAAM,QAAS,KAAM,cAAe,EACtC,CAAE,KAAM,UAAW,KAAM,WAAY,EACrC,CAAE,KAAM,QAAS,KAAM,YAAa,EACpC,CAAE,KAAM,UAAW,KAAM,gBAAiB,CAC5C,CACF,CACF,CACF,CACF,EACA,CACE,CACE,MAAAF,EACA,OAAArC,EACA,MAAAsC,EACA,UAAArC,EACA,SAAU,CACR,aAAcM,EAAS,aACvB,UAAWA,EAAS,UACpB,WAAYA,EAAS,WACrB,eAAgBA,EAAS,cAC3B,CACF,CACF,CAAA,CAEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ERC20VariableCriteriaIncentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,GAAG,EAQT,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAE7C,MAAM,WAAW,qCAAqC;IACpD;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAqC;IACjE;;;;;;OAMG;IACH,OAAuB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"ERC20VariableCriteriaIncentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iCAAiC,EAGlC,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,OAAO,EACZ,KAAK,GAAG,EAQT,MAAM,MAAM,CAAC;AAEd,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAOlC,OAAO,EAAc,KAAK,UAAU,EAAE,MAAM,UAAU,CAAC;AACvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,iCAAiC,EAAE,CAAC;AAE7C,MAAM,WAAW,qCAAqC;IACpD;;;;OAIG;IACH,KAAK,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;;;;OAKG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,QAAQ,EAAE,iBAAiB,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAChC;;;;OAIG;IACH,YAAY,EAAE,aAAa,CAAC;IAC5B;;;;OAIG;IACH,SAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAAqC;IACjE;;;;;;OAMG;IACH,OAAuB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAKnD;IAEF;;OAEG;IAEH;;;;;;OAMG;IACU,oBAAoB,CAC/B,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,iBAAiB,CAAC;IAiB7B;;;;;;;OAOG;IACmB,eAAe,CAAC,SAAS,EAAE,GAAG;IAqCpD;;;;;;OAMG;IACU,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAY/D;;;;;;;OAOG;IACU,kBAAkB,CAC7B,EAAE,OAAO,EAAE,IAAI,EAAE,eAAe,EAAE,EAAE,wBAAwB,EAC5D,MAAM,CAAC,EAAE,UAAU,GAClB,OAAO,CAAC,MAAM,CAAC;IAkFlB;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,qCAAqC,EAChD,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;CAY3B;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,0BAA0B,IAAI,iBAAiB,CAO9D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4CAA4C,CAAC,EAC3D,KAAK,EACL,MAAM,EACN,KAAK,EACL,SAAc,EACd,QAAQ,GACT,EAAE,qCAAqC,iBAuCvC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { getTransactionReceipt as
|
|
3
|
-
import { decodeAbiParameters as
|
|
4
|
-
import { b as
|
|
5
|
-
import { SignatureType as
|
|
6
|
-
import { IncentiveCriteriaNotFoundError as
|
|
7
|
-
import { CheatCodes as
|
|
8
|
-
import { ERC20VariableIncentive as
|
|
9
|
-
const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6120aa806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b14610703578063fe9fbb8014610716578063fee81cf414610735575f80fd5b8063ec87621c146106dc578063f04e283e146106f0575f80fd5b8063db09da12116100ac578063db09da1214610689578063dcc21361146106a8578063dcc59b6f146106c7575f80fd5b8063c884ef8314610646578063d54ad2a114610674575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf146105f4578063be4994f814610613578063c213f3f914610632575f80fd5b8063a4d66daf146105be578063a871ced2146105d3575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105a6575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a61029536600461180a565b610766565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611850565b6107c1565b005b6102df6102ef366004611888565b6107ce565b3480156102ff575f80fd5b5061029a61030e366004611888565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df6107e4565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be6103993660046118b2565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611850565b610831565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a366004611915565b6108ed565b34801561044a575f80fd5b506102df6104593660046119bf565b6109e7565b348015610469575f80fd5b5061047d6104783660046119bf565b610cd1565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b5366004611888565b610e33565b3480156104c5575f80fd5b506104d96104d43660046119bf565b610e45565b6040516102a69190611a4a565b3480156104f1575f80fd5b5061029a610500366004611888565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610f2e565b34801561052e575f80fd5b506102be60065481565b6102df610f67565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105969260ff908116929190811690610100900473ffffffffffffffffffffffffffffffffffffffff1684565b6040516102a69493929190611a9d565b3480156105b1575f80fd5b50638b78c6d819546103fb565b3480156105c9575f80fd5b506102be60025481565b3480156105de575f80fd5b506105e7610f7a565b6040516102a69190611b25565b3480156105ff575f80fd5b5061029a61060e366004611b33565b611014565b34801561061e575f80fd5b506102df61062d366004611915565b611245565b34801561063d575f80fd5b506006546102be565b348015610651575f80fd5b5061029a6106603660046118b2565b60016020525f908152604090205460ff1681565b34801561067f575f80fd5b506102be60055481565b348015610694575f80fd5b5061029a6106a3366004611b33565b6112e3565b3480156106b3575f80fd5b506102df6106c2366004611915565b6112f9565b3480156106d2575f80fd5b506102be60045481565b3480156106e7575f80fd5b506102be600181565b6102df6106fe3660046118b2565b611397565b6102df6107113660046118b2565b6113d1565b348015610721575f80fd5b5061029a6107303660046118b2565b6113f7565b348015610740575f80fd5b506102be61074f3660046118b2565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611456565b92915050565b6107cb33826114ab565b50565b6107d66114b6565b6107e082826114d0565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b600161083c816114dc565b815f03610875576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035461089a9073ffffffffffffffffffffffffffffffffffffffff1633308561150d565b8160025f8282546108ab9190611bb1565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b60026108f8816114dc565b838214610931576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df575f84848381811061094e5761094e611bc4565b90506020020160208101906109639190611bf1565b90508015156001036109a5576109a087878481811061098457610984611bc4565b905060200201602081019061099991906118b2565b60016114d0565b6109d6565b6109d68787848181106109ba576109ba611bc4565b90506020020160208101906109cf91906118b2565b60016114ab565b50600101610933565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a385760018160011c14303b10610a2f5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a4683850185611cac565b805160208201516040830151606084015160808501519495509293919290915f839003610a9f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610ac073ffffffffffffffffffffffffffffffffffffffff87163061156f565b905083811015610b295786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bba57610bba611a5c565b02179055506020820151600182015560408201516002909101805460609093015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090931660ff90921691909117919091179055610c31336115a2565b610c3c3360016115ea565b8573ffffffffffffffffffffffffffffffffffffffff167f4dfcc2b9ad954a56fe7153ce6568e2d30033d056714ca4acaa4620b12e1a1a2486868686604051610c889493929190611d83565b60405180910390a2505050505050508015610ccc576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cde816114dc565b5f610ceb85870187611e57565b90505f8160200151806020019051810190610d069190611ed6565b90508060025f828254610d199190611eed565b90915550508151600354610d469173ffffffffffffffffffffffffffffffffffffffff909116908361162b565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e0491611a4a565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610e3b6114b6565b6107e082826114ab565b60605f80610e5584860186611f00565b9250509150604051806080016040528060016002811115610e7857610e78611a5c565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610ed79151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f159190602001611f32565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f6f6114b6565b610f785f61167e565b565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810190915260078054829060ff166001811115610fc257610fc2611a5c565b6001811115610fd357610fd3611a5c565b81526001820154602082015260029091015460ff81166040830152610100900473ffffffffffffffffffffffffffffffffffffffff16606090910152919050565b5f61101d6114b6565b5f61102a83850185611fa8565b90505f81602001518060200190518101906110459190611ed6565b90505f6110556002546005541090565b61108b576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f0361109a5750806110bd565b670de0b6b3a7640000825f546110b09190612025565b6110ba919061203c565b90505b600654158015906110cf575060065481115b156110d957506006545b600254816005546110ea9190611bb1565b1115611122576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111339190611bb1565b92505081905550600160045f82825461114c9190611bb1565b90915550506003546111759073ffffffffffffffffffffffffffffffffffffffff16888361162b565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261123091611a4a565b60405180910390a25060019695505050505050565b6002611250816114dc565b838214611289576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df576112db8686838181106112a8576112a8611bc4565b90506020020160208101906112bd91906118b2565b8585848181106112cf576112cf611bc4565b905060200201356114d0565b60010161128b565b5f6112f16002546005541090565b949350505050565b6002611304816114dc565b83821461133d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df5761138f86868381811061135c5761135c611bc4565b905060200201602081019061137191906118b2565b85858481811061138357611383611bc4565b905060200201356114ab565b60010161133f565b61139f6114b6565b63389a75e1600c52805f526020600c2080544211156113c557636f5e88185f526004601cfd5b5f90556107cb8161167e565b6113d96114b6565b8060601b6113ee57637448fbae5f526004601cfd5b6107cb8161167e565b5f8173ffffffffffffffffffffffffffffffffffffffff1661141c638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107bb5750638b78c6d8600c9081525f839052602090205460031615156107bb565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107bb57506107bb826116c8565b6107e082825f61171d565b638b78c6d819543314610f78576382b429005f526004601cfd5b6107e08282600161171d565b638b78c6d8195433146107cb57638b78c6d8600c52335f52806020600c2054166107cb576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661156157803d873b15171061156157637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661167457803d853b151710611674576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611774565b638b78c6d8600c52825f526020600c2080548381178361173e575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107bb565b5f6020828403121561181a575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611849575f80fd5b9392505050565b5f60208284031215611860575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107cb575f80fd5b5f8060408385031215611899575f80fd5b82356118a481611867565b946020939093013593505050565b5f602082840312156118c2575f80fd5b813561184981611867565b5f8083601f8401126118dd575f80fd5b50813567ffffffffffffffff8111156118f4575f80fd5b6020830191508360208260051b850101111561190e575f80fd5b9250929050565b5f805f8060408587031215611928575f80fd5b843567ffffffffffffffff81111561193e575f80fd5b61194a878288016118cd565b909550935050602085013567ffffffffffffffff811115611969575f80fd5b611975878288016118cd565b95989497509550505050565b5f8083601f840112611991575f80fd5b50813567ffffffffffffffff8111156119a8575f80fd5b60208301915083602082850101111561190e575f80fd5b5f80602083850312156119d0575f80fd5b823567ffffffffffffffff8111156119e6575f80fd5b6119f285828601611981565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61184960208301846119fe565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110611a9957611a99611a5c565b9052565b60808101611aab8287611a89565b84602083015260ff8416604083015273ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b611aea828251611a89565b6020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301525050565b608081016107bb8284611adf565b5f805f60408486031215611b45575f80fd5b8335611b5081611867565b9250602084013567ffffffffffffffff811115611b6b575f80fd5b611b7786828701611981565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107bb576107bb611b84565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611c01575f80fd5b81358015158114611849575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611c6057611c60611c10565b60405290565b6040516080810167ffffffffffffffff81118282101715611c6057611c60611c10565b6040805190810167ffffffffffffffff81118282101715611c6057611c60611c10565b5f81830361010081128015611cbf575f80fd5b50611cc8611c3d565b8335611cd381611867565b815260208481013590820152604080850135908201526060808501359082015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611d22575f80fd5b611d2a611c66565b9150608084013560028110611d3d575f80fd5b825260a0840135602083015260c084013560ff81168114611d5c575f80fd5b604083015260e0840135611d6f81611867565b606083015260808101919091529392505050565b848152602081018490526040810183905260e08101611da56060830184611adf565b95945050505050565b5f82601f830112611dbd575f80fd5b813567ffffffffffffffff811115611dd757611dd7611c10565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611e2457611e24611c10565b604052818152838201602001851015611e3b575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611e67575f80fd5b813567ffffffffffffffff811115611e7d575f80fd5b820160408185031215611e8e575f80fd5b611e96611c89565b8135611ea181611867565b8152602082013567ffffffffffffffff811115611ebc575f80fd5b611ec886828501611dae565b602083015250949350505050565b5f60208284031215611ee6575f80fd5b5051919050565b818103818111156107bb576107bb611b84565b5f805f60608486031215611f12575f80fd5b8335611f1d81611867565b95602085013595506040909401359392505050565b602081525f825160038110611f4957611f49611a5c565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526112f160a08401826119fe565b5f60208284031215611fb8575f80fd5b813567ffffffffffffffff811115611fce575f80fd5b820160408185031215611fdf575f80fd5b611fe7611c89565b813567ffffffffffffffff811115611ffd575f80fd5b61200986828501611dae565b825250602082013567ffffffffffffffff811115611ebc575f80fd5b80820281158282048414176107bb576107bb611b84565b5f8261206f577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122002cb02f574ade708d1d5aab7fb7184f2ca850079b21767cde9fb97481599ce8d64736f6c634300081a0033", u = class u extends F {
|
|
1
|
+
import { c as m, b4 as h, b5 as C } from "../generated-ffteMTHN.js";
|
|
2
|
+
import { getTransactionReceipt as T, getTransaction as x } from "@wagmi/core";
|
|
3
|
+
import { decodeAbiParameters as p, parseEther as A, parseEventLogs as v, decodeFunctionData as R, encodeAbiParameters as N, zeroHash as D, zeroAddress as V } from "viem";
|
|
4
|
+
import { b as B } from "../deployments-B-ZU0zVY.js";
|
|
5
|
+
import { SignatureType as u } from "../Actions/EventAction.js";
|
|
6
|
+
import { IncentiveCriteriaNotFoundError as _, NoMatchingLogsError as E, DecodedArgsError as o, InvalidCriteriaTypeError as S } from "../errors.js";
|
|
7
|
+
import { CheatCodes as I } from "../utils.js";
|
|
8
|
+
import { ERC20VariableIncentive as $ } from "./ERC20VariableIncentive.js";
|
|
9
|
+
const F = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd198054600181161560365763f92ee8a95f526004601cfd5b6001600160401b03808260011c146077578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b6120aa806100895f395ff3fe608060405260043610610277575f3560e01c8063715018a61161014b578063c884ef83116100c6578063ec87621c1161007c578063f2fde38b11610062578063f2fde38b14610703578063fe9fbb8014610716578063fee81cf414610735575f80fd5b8063ec87621c146106dc578063f04e283e146106f0575f80fd5b8063db09da12116100ac578063db09da1214610689578063dcc21361146106a8578063dcc59b6f146106c7575f80fd5b8063c884ef8314610646578063d54ad2a114610674575f80fd5b8063a4d66daf1161011b578063bb1757cf11610101578063bb1757cf146105f4578063be4994f814610613578063c213f3f914610632575f80fd5b8063a4d66daf146105be578063a871ced2146105d3575f80fd5b8063715018a61461053857806375b238fc1461054057806377548687146105545780638da5cb5b146105a6575f80fd5b806330db555f116101f55780634a4ee7b1116101ab578063514e62fc11610191578063514e62fc146104e657806354d1f13d1461051b57806366a78e6c14610523575f80fd5b80634a4ee7b1146104a75780634e7165a2146104ba575f80fd5b80634359d28a116101db5780634359d28a14610420578063439fab911461043f578063474f5a441461045e575f80fd5b806330db555f146103b057806338d52e0f146103cf575f80fd5b80631cd64df41161024a5780632569296211610230578063256929621461033d57806328d6183b146103455780632de948071461037f575f80fd5b80631cd64df4146102f4578063228cb73314610329575f80fd5b806301ffc9a71461027b57806307621eca146102af578063183a4f6e146102cc5780631c10893f146102e1575b5f80fd5b348015610286575f80fd5b5061029a61029536600461180a565b610766565b60405190151581526020015b60405180910390f35b3480156102ba575f80fd5b505f545b6040519081526020016102a6565b6102df6102da366004611850565b6107c1565b005b6102df6102ef366004611888565b6107ce565b3480156102ff575f80fd5b5061029a61030e366004611888565b638b78c6d8600c9081525f9290925260209091205481161490565b348015610334575f80fd5b506102be5f5481565b6102df6107e4565b348015610350575f80fd5b506040517f52b8e45c0000000000000000000000000000000000000000000000000000000081526020016102a6565b34801561038a575f80fd5b506102be6103993660046118b2565b638b78c6d8600c9081525f91909152602090205490565b3480156103bb575f80fd5b506102df6103ca366004611850565b610831565b3480156103da575f80fd5b506003546103fb9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016102a6565b34801561042b575f80fd5b506102df61043a366004611915565b6108ed565b34801561044a575f80fd5b506102df6104593660046119bf565b6109e7565b348015610469575f80fd5b5061047d6104783660046119bf565b610cd1565b6040805192835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016102a6565b6102df6104b5366004611888565b610e33565b3480156104c5575f80fd5b506104d96104d43660046119bf565b610e45565b6040516102a69190611a4a565b3480156104f1575f80fd5b5061029a610500366004611888565b638b78c6d8600c9081525f9290925260209091205416151590565b6102df610f2e565b34801561052e575f80fd5b506102be60065481565b6102df610f67565b34801561054b575f80fd5b506102be600281565b34801561055f575f80fd5b506007546008546009546105969260ff908116929190811690610100900473ffffffffffffffffffffffffffffffffffffffff1684565b6040516102a69493929190611a9d565b3480156105b1575f80fd5b50638b78c6d819546103fb565b3480156105c9575f80fd5b506102be60025481565b3480156105de575f80fd5b506105e7610f7a565b6040516102a69190611b25565b3480156105ff575f80fd5b5061029a61060e366004611b33565b611014565b34801561061e575f80fd5b506102df61062d366004611915565b611245565b34801561063d575f80fd5b506006546102be565b348015610651575f80fd5b5061029a6106603660046118b2565b60016020525f908152604090205460ff1681565b34801561067f575f80fd5b506102be60055481565b348015610694575f80fd5b5061029a6106a3366004611b33565b6112e3565b3480156106b3575f80fd5b506102df6106c2366004611915565b6112f9565b3480156106d2575f80fd5b506102be60045481565b3480156106e7575f80fd5b506102be600181565b6102df6106fe3660046118b2565b611397565b6102df6107113660046118b2565b6113d1565b348015610721575f80fd5b5061029a6107303660046118b2565b6113f7565b348015610740575f80fd5b506102be61074f3660046118b2565b63389a75e1600c9081525f91909152602090205490565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f52b8e45c0000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611456565b92915050565b6107cb33826114ab565b50565b6107d66114b6565b6107e082826114d0565b5050565b5f6202a30067ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b600161083c816114dc565b815f03610875576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60035461089a9073ffffffffffffffffffffffffffffffffffffffff1633308561150d565b8160025f8282546108ab9190611bb1565b909155505060408051338152602081018490527fa64c2da41decbd538f8629e54c8fa0b7362c9102b691386a0fb6a1797454e9c6910160405180910390a15050565b60026108f8816114dc565b838214610931576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df575f84848381811061094e5761094e611bc4565b90506020020160208101906109639190611bf1565b90508015156001036109a5576109a087878481811061098457610984611bc4565b905060200201602081019061099991906118b2565b60016114d0565b6109d6565b6109d68787848181106109ba576109ba611bc4565b90506020020160208101906109cf91906118b2565b60016114ab565b50600101610933565b505050505050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011328054600382558015610a385760018160011c14303b10610a2f5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f610a4683850185611cac565b805160208201516040830151606084015160808501519495509293919290915f839003610a9f576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f610ac073ffffffffffffffffffffffffffffffffffffffff87163061156f565b905083811015610b295786516040517f5c54305e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff9091166004820152602481018290526044810185905260640160405180910390fd5b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff88161790555f8581556002859055600684905560055581516007805484929082907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660018381811115610bba57610bba611a5c565b02179055506020820151600182015560408201516002909101805460609093015173ffffffffffffffffffffffffffffffffffffffff16610100027fffffffffffffffffffffff00000000000000000000000000000000000000000090931660ff90921691909117919091179055610c31336115a2565b610c3c3360016115ea565b8573ffffffffffffffffffffffffffffffffffffffff167f4dfcc2b9ad954a56fe7153ce6568e2d30033d056714ca4acaa4620b12e1a1a2486868686604051610c889493929190611d83565b60405180910390a2505050505050508015610ccc576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f806001610cde816114dc565b5f610ceb85870187611e57565b90505f8160200151806020019051810190610d069190611ed6565b90508060025f828254610d199190611eed565b90915550508151600354610d469173ffffffffffffffffffffffffffffffffffffffff909116908361162b565b81516003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529183901b90911660348201526048810183905273ffffffffffffffffffffffffffffffffffffffff909116907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815290829052610e0491611a4a565b60405180910390a260035490945073ffffffffffffffffffffffffffffffffffffffff16925050509250929050565b610e3b6114b6565b6107e082826114ab565b60605f80610e5584860186611f00565b9250509150604051806080016040528060016002811115610e7857610e78611a5c565b81526020018373ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff168152602001604051806020016040528084815250604051602001610ed79151815260200190565b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152918152915251610f159190602001611f32565b6040516020818303038152906040529250505092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b610f6f6114b6565b610f785f61167e565b565b604080516080810182525f808252602082018190529181018290526060810191909152604080516080810190915260078054829060ff166001811115610fc257610fc2611a5c565b6001811115610fd357610fd3611a5c565b81526001820154602082015260029091015460ff81166040830152610100900473ffffffffffffffffffffffffffffffffffffffff16606090910152919050565b5f61101d6114b6565b5f61102a83850185611fa8565b90505f81602001518060200190518101906110459190611ed6565b90505f6110556002546005541090565b61108b576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f545f0361109a5750806110bd565b670de0b6b3a7640000825f546110b09190612025565b6110ba919061203c565b90505b600654158015906110cf575060065481115b156110d957506006545b600254816005546110ea9190611bb1565b1115611122576040517f360e42e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060055f8282546111339190611bb1565b92505081905550600160045f82825461114c9190611bb1565b90915550506003546111759073ffffffffffffffffffffffffffffffffffffffff16888361162b565b6003546040517fffffffffffffffffffffffffffffffffffffffff000000000000000000000000606092831b811660208301529189901b90911660348201526048810182905273ffffffffffffffffffffffffffffffffffffffff8816907f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d390606801604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529082905261123091611a4a565b60405180910390a25060019695505050505050565b6002611250816114dc565b838214611289576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df576112db8686838181106112a8576112a8611bc4565b90506020020160208101906112bd91906118b2565b8585848181106112cf576112cf611bc4565b905060200201356114d0565b60010161128b565b5f6112f16002546005541090565b949350505050565b6002611304816114dc565b83821461133d576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b848110156109df5761138f86868381811061135c5761135c611bc4565b905060200201602081019061137191906118b2565b85858481811061138357611383611bc4565b905060200201356114ab565b60010161133f565b61139f6114b6565b63389a75e1600c52805f526020600c2080544211156113c557636f5e88185f526004601cfd5b5f90556107cb8161167e565b6113d96114b6565b8060601b6113ee57637448fbae5f526004601cfd5b6107cb8161167e565b5f8173ffffffffffffffffffffffffffffffffffffffff1661141c638b78c6d8195490565b73ffffffffffffffffffffffffffffffffffffffff1614806107bb5750638b78c6d8600c9081525f839052602090205460031615156107bb565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f903181110000000000000000000000000000000000000000000000000000000014806107bb57506107bb826116c8565b6107e082825f61171d565b638b78c6d819543314610f78576382b429005f526004601cfd5b6107e08282600161171d565b638b78c6d8195433146107cb57638b78c6d8600c52335f52806020600c2054166107cb576382b429005f526004601cfd5b60405181606052826040528360601b602c526f23b872dd000000000000000000000000600c5260205f6064601c5f895af18060015f51141661156157803d873b15171061156157637939f4245f526004601cfd5b505f60605260405250505050565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b73ffffffffffffffffffffffffffffffffffffffff16638b78c6d819819055805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08180a350565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af18060015f51141661167457803d853b151710611674576390b8ec185f526004601cfd5b505f603452505050565b638b78c6d819805473ffffffffffffffffffffffffffffffffffffffff9092169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a355565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167fa92167050000000000000000000000000000000000000000000000000000000014806107bb57506107bb82611774565b638b78c6d8600c52825f526020600c2080548381178361173e575080841681185b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f7fffffffff0000000000000000000000000000000000000000000000000000000082167f6ab67a0d0000000000000000000000000000000000000000000000000000000014806107bb57507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316146107bb565b5f6020828403121561181a575f80fd5b81357fffffffff0000000000000000000000000000000000000000000000000000000081168114611849575f80fd5b9392505050565b5f60208284031215611860575f80fd5b5035919050565b73ffffffffffffffffffffffffffffffffffffffff811681146107cb575f80fd5b5f8060408385031215611899575f80fd5b82356118a481611867565b946020939093013593505050565b5f602082840312156118c2575f80fd5b813561184981611867565b5f8083601f8401126118dd575f80fd5b50813567ffffffffffffffff8111156118f4575f80fd5b6020830191508360208260051b850101111561190e575f80fd5b9250929050565b5f805f8060408587031215611928575f80fd5b843567ffffffffffffffff81111561193e575f80fd5b61194a878288016118cd565b909550935050602085013567ffffffffffffffff811115611969575f80fd5b611975878288016118cd565b95989497509550505050565b5f8083601f840112611991575f80fd5b50813567ffffffffffffffff8111156119a8575f80fd5b60208301915083602082850101111561190e575f80fd5b5f80602083850312156119d0575f80fd5b823567ffffffffffffffff8111156119e6575f80fd5b6119f285828601611981565b90969095509350505050565b5f81518084528060208401602086015e5f6020828601015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f83011685010191505092915050565b602081525f61184960208301846119fe565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110611a9957611a99611a5c565b9052565b60808101611aab8287611a89565b84602083015260ff8416604083015273ffffffffffffffffffffffffffffffffffffffff8316606083015295945050505050565b611aea828251611a89565b6020810151602083015260ff604082015116604083015273ffffffffffffffffffffffffffffffffffffffff60608201511660608301525050565b608081016107bb8284611adf565b5f805f60408486031215611b45575f80fd5b8335611b5081611867565b9250602084013567ffffffffffffffff811115611b6b575f80fd5b611b7786828701611981565b9497909650939450505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b808201808211156107bb576107bb611b84565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f60208284031215611c01575f80fd5b81358015158114611849575f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b60405160a0810167ffffffffffffffff81118282101715611c6057611c60611c10565b60405290565b6040516080810167ffffffffffffffff81118282101715611c6057611c60611c10565b6040805190810167ffffffffffffffff81118282101715611c6057611c60611c10565b5f81830361010081128015611cbf575f80fd5b50611cc8611c3d565b8335611cd381611867565b815260208481013590820152604080850135908201526060808501359082015260807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8083011215611d22575f80fd5b611d2a611c66565b9150608084013560028110611d3d575f80fd5b825260a0840135602083015260c084013560ff81168114611d5c575f80fd5b604083015260e0840135611d6f81611867565b606083015260808101919091529392505050565b848152602081018490526040810183905260e08101611da56060830184611adf565b95945050505050565b5f82601f830112611dbd575f80fd5b813567ffffffffffffffff811115611dd757611dd7611c10565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0908116603f0116810167ffffffffffffffff81118282101715611e2457611e24611c10565b604052818152838201602001851015611e3b575f80fd5b816020850160208301375f918101602001919091529392505050565b5f60208284031215611e67575f80fd5b813567ffffffffffffffff811115611e7d575f80fd5b820160408185031215611e8e575f80fd5b611e96611c89565b8135611ea181611867565b8152602082013567ffffffffffffffff811115611ebc575f80fd5b611ec886828501611dae565b602083015250949350505050565b5f60208284031215611ee6575f80fd5b5051919050565b818103818111156107bb576107bb611b84565b5f805f60608486031215611f12575f80fd5b8335611f1d81611867565b95602085013595506040909401359392505050565b602081525f825160038110611f4957611f49611a5c565b8060208401525073ffffffffffffffffffffffffffffffffffffffff602084015116604083015273ffffffffffffffffffffffffffffffffffffffff604084015116606083015260608301516080808401526112f160a08401826119fe565b5f60208284031215611fb8575f80fd5b813567ffffffffffffffff811115611fce575f80fd5b820160408185031215611fdf575f80fd5b611fe7611c89565b813567ffffffffffffffff811115611ffd575f80fd5b61200986828501611dae565b825250602082013567ffffffffffffffff811115611ebc575f80fd5b80820281158282048414176107bb576107bb611b84565b5f8261206f577f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b50049056fea264697066735822122002cb02f574ade708d1d5aab7fb7184f2ca850079b21767cde9fb97481599ce8d64736f6c634300081a0033", s = { BASE_URL: "/", DEV: !1, MODE: "production", PROD: !0, SSR: !1, VITE_BOOST_MAINNET_SIGNER_EOA: "0xCBD0C302040bC803B4B2EDaF21Be0e49Deff5480", VITE_BOOST_TESTNET_SIGNER_EOA: "0xd63167e9db11B108940b2E8236581F961f33f396" }, l = class l extends $ {
|
|
10
10
|
constructor() {
|
|
11
|
-
super(...arguments), this.abi =
|
|
11
|
+
super(...arguments), this.abi = m;
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
*Functions from the ERC20VariableIncentive contract
|
|
@@ -22,7 +22,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
22
22
|
*/
|
|
23
23
|
async getIncentiveCriteria(e) {
|
|
24
24
|
try {
|
|
25
|
-
return await
|
|
25
|
+
return await h(
|
|
26
26
|
this._config,
|
|
27
27
|
{
|
|
28
28
|
...e,
|
|
@@ -30,7 +30,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
30
30
|
}
|
|
31
31
|
);
|
|
32
32
|
} catch (a) {
|
|
33
|
-
throw new
|
|
33
|
+
throw new _(a);
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
@@ -42,7 +42,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
42
42
|
* @returns {Promise<bigint>} Returns the reward amount from a claim data payload
|
|
43
43
|
*/
|
|
44
44
|
async decodeClaimData(e) {
|
|
45
|
-
const a =
|
|
45
|
+
const a = p(
|
|
46
46
|
[
|
|
47
47
|
{
|
|
48
48
|
type: "tuple",
|
|
@@ -54,7 +54,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
54
54
|
}
|
|
55
55
|
],
|
|
56
56
|
e
|
|
57
|
-
), d =
|
|
57
|
+
), d = p(
|
|
58
58
|
[{ type: "uint256" }],
|
|
59
59
|
a[0].incentiveData
|
|
60
60
|
)[0];
|
|
@@ -63,7 +63,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
63
63
|
this.reward(),
|
|
64
64
|
this.getMaxReward()
|
|
65
65
|
]);
|
|
66
|
-
return f === 0n || (b = f * d /
|
|
66
|
+
return f === 0n || (b = f * d / A("1"), n !== 0n && b > n && (b = n)), b;
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Fetches the IncentiveCriteria struct from the contract
|
|
@@ -73,7 +73,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
73
73
|
* @throws {IncentiveCriteriaNotFoundError}
|
|
74
74
|
*/
|
|
75
75
|
async getMaxReward(e) {
|
|
76
|
-
return await
|
|
76
|
+
return await C(
|
|
77
77
|
this._config,
|
|
78
78
|
{
|
|
79
79
|
...e,
|
|
@@ -92,46 +92,46 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
92
92
|
async getIncentiveScalar({ chainId: e, hash: a, knownSignatures: d }, b) {
|
|
93
93
|
var n;
|
|
94
94
|
const f = await this.getIncentiveCriteria(b);
|
|
95
|
-
if (f.criteriaType ===
|
|
96
|
-
const c = await
|
|
95
|
+
if (f.criteriaType === u.EVENT) {
|
|
96
|
+
const c = await T(this._config, {
|
|
97
97
|
chainId: e,
|
|
98
98
|
hash: a
|
|
99
99
|
});
|
|
100
|
-
if (f.fieldIndex ===
|
|
100
|
+
if (f.fieldIndex === I.GAS_REBATE_INCENTIVE)
|
|
101
101
|
return c.gasUsed * c.effectiveGasPrice + // Normal gas cost
|
|
102
102
|
(c.blobGasUsed ?? 0n) * (c.blobGasPrice ?? 0n);
|
|
103
103
|
const r = c.logs;
|
|
104
104
|
if (r.length === 0)
|
|
105
|
-
throw new
|
|
105
|
+
throw new E(
|
|
106
106
|
`No logs found for event signature ${f.signature}`
|
|
107
107
|
);
|
|
108
108
|
try {
|
|
109
|
-
const i = d[f.signature], t =
|
|
109
|
+
const i = d[f.signature], t = v({
|
|
110
110
|
abi: [i],
|
|
111
111
|
logs: r
|
|
112
112
|
});
|
|
113
113
|
if (t == null || t.length === 0)
|
|
114
|
-
throw new
|
|
114
|
+
throw new E(
|
|
115
115
|
`No logs found for event signature ${f.signature}`
|
|
116
116
|
);
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
117
|
+
const g = ((n = t[0]) == null ? void 0 : n.args)[f.fieldIndex];
|
|
118
|
+
if (g === void 0)
|
|
119
119
|
throw new o(
|
|
120
120
|
`Decoded argument at index ${f.fieldIndex} is undefined`
|
|
121
121
|
);
|
|
122
|
-
return BigInt(
|
|
122
|
+
return BigInt(g);
|
|
123
123
|
} catch (i) {
|
|
124
124
|
throw new o(
|
|
125
125
|
`Failed to decode event log for signature ${f.signature}: ${i.message}`
|
|
126
126
|
);
|
|
127
127
|
}
|
|
128
|
-
} else if (f.criteriaType ===
|
|
129
|
-
const c = await
|
|
128
|
+
} else if (f.criteriaType === u.FUNC) {
|
|
129
|
+
const c = await x(this._config, {
|
|
130
130
|
chainId: e,
|
|
131
131
|
hash: a
|
|
132
132
|
});
|
|
133
133
|
try {
|
|
134
|
-
const r = d[f.signature], t =
|
|
134
|
+
const r = d[f.signature], t = R({
|
|
135
135
|
abi: [r],
|
|
136
136
|
data: c.input
|
|
137
137
|
}).args[f.fieldIndex];
|
|
@@ -146,7 +146,7 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
146
146
|
);
|
|
147
147
|
}
|
|
148
148
|
} else
|
|
149
|
-
throw new
|
|
149
|
+
throw new S(
|
|
150
150
|
`Invalid criteria type ${f.criteriaType}`
|
|
151
151
|
);
|
|
152
152
|
}
|
|
@@ -164,34 +164,34 @@ const _ = "0x6080604052348015600e575f80fd5b5060156019565b607c565b63409feecd19805
|
|
|
164
164
|
a
|
|
165
165
|
);
|
|
166
166
|
return {
|
|
167
|
-
abi:
|
|
168
|
-
bytecode:
|
|
169
|
-
args: [
|
|
167
|
+
abi: m,
|
|
168
|
+
bytecode: F,
|
|
169
|
+
args: [P(d)],
|
|
170
170
|
...this.optionallyAttachAccount(b.account)
|
|
171
171
|
};
|
|
172
172
|
}
|
|
173
173
|
};
|
|
174
|
-
|
|
175
|
-
31337: void 0,
|
|
176
|
-
...
|
|
174
|
+
l.bases = {
|
|
175
|
+
...s != null && s.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE ? { 31337: void 0 } : {},
|
|
176
|
+
...B
|
|
177
177
|
};
|
|
178
|
-
let y =
|
|
178
|
+
let y = l;
|
|
179
179
|
function q() {
|
|
180
180
|
return {
|
|
181
|
-
criteriaType:
|
|
181
|
+
criteriaType: u.EVENT,
|
|
182
182
|
signature: D,
|
|
183
|
-
fieldIndex:
|
|
184
|
-
targetContract:
|
|
183
|
+
fieldIndex: I.GAS_REBATE_INCENTIVE,
|
|
184
|
+
targetContract: V
|
|
185
185
|
};
|
|
186
186
|
}
|
|
187
|
-
function
|
|
188
|
-
asset:
|
|
187
|
+
function P({
|
|
188
|
+
asset: w,
|
|
189
189
|
reward: e,
|
|
190
190
|
limit: a,
|
|
191
191
|
maxReward: d = 0n,
|
|
192
192
|
criteria: b
|
|
193
193
|
}) {
|
|
194
|
-
return
|
|
194
|
+
return N(
|
|
195
195
|
[
|
|
196
196
|
{
|
|
197
197
|
type: "tuple",
|
|
@@ -216,7 +216,7 @@ function B({
|
|
|
216
216
|
],
|
|
217
217
|
[
|
|
218
218
|
{
|
|
219
|
-
asset:
|
|
219
|
+
asset: w,
|
|
220
220
|
reward: e,
|
|
221
221
|
limit: a,
|
|
222
222
|
maxReward: d,
|
|
@@ -232,8 +232,8 @@ function B({
|
|
|
232
232
|
}
|
|
233
233
|
export {
|
|
234
234
|
y as ERC20VariableCriteriaIncentive,
|
|
235
|
-
|
|
235
|
+
m as erc20VariableCriteriaIncentiveAbi,
|
|
236
236
|
q as gasRebateIncentiveCriteria,
|
|
237
|
-
|
|
237
|
+
P as prepareERC20VariableCriteriaIncentivePayload
|
|
238
238
|
};
|
|
239
239
|
//# sourceMappingURL=ERC20VariableCriteriaIncentive.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ERC20VariableCriteriaIncentive.js","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveAbi,\n readErc20VariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveGetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentive as ERC20VariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveAbi };\n\nexport interface ERC20VariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\nexport interface IncentiveCriteria {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n}\n\nexport interface ReadIncentiveCriteriaParams extends ReadParams {}\n\nexport interface GetIncentiveScalarParams {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @deprecated Please use only v2 implementations\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentive}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentivePayload, typeof erc20VariableCriteriaIncentiveAbi>}\n */\nexport class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentivePayload,\n typeof erc20VariableCriteriaIncentiveAbi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE,\n ...(ERC20VariableCriteriaIncentiveBases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveGetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteria(): IncentiveCriteria {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentivePayload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentive","ERC20VariableIncentive","erc20VariableCriteriaIncentiveAbi","params","readErc20VariableCriteriaIncentiveGetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentivePayload","ERC20VariableCriteriaIncentiveBases","ERC20VariableCriteri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,IACvB,gBAAgBwB;AAAA,EAAA;AAEpB;AAaO,SAASL,EAA6C;AAAA,EAC3D,OAAAM;AAAA,EACA,QAAApC;AAAA,EACA,OAAAqC;AAAA,EACA,WAAApC,IAAY;AAAA,EACZ,UAAAM;AACF,GAA0C;AACjC,SAAA+B;AAAA,IACL;AAAA,MACE;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,YAAY;AAAA,UACV,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,UACjC,EAAE,MAAM,WAAW,MAAM,SAAS;AAAA,UAClC,EAAE,MAAM,WAAW,MAAM,QAAQ;AAAA,UACjC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,UACrC;AAAA,YACE,MAAM;AAAA,YACN,MAAM;AAAA,YACN,YAAY;AAAA,cACV,EAAE,MAAM,SAAS,MAAM,eAAe;AAAA,cACtC,EAAE,MAAM,WAAW,MAAM,YAAY;AAAA,cACrC,EAAE,MAAM,SAAS,MAAM,aAAa;AAAA,cACpC,EAAE,MAAM,WAAW,MAAM,iBAAiB;AAAA,YAC5C;AAAA,UACF;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,IACA;AAAA,MACE;AAAA,QACE,OAAAF;AAAA,QACA,QAAApC;AAAA,QACA,OAAAqC;AAAA,QACA,WAAApC;AAAA,QACA,UAAU;AAAA,UACR,cAAcM,EAAS;AAAA,UACvB,WAAWA,EAAS;AAAA,UACpB,YAAYA,EAAS;AAAA,UACrB,gBAAgBA,EAAS;AAAA,QAC3B;AAAA,MACF;AAAA,IACF;AAAA,EAAA;AAEJ;"}
|
|
1
|
+
{"version":3,"file":"ERC20VariableCriteriaIncentive.js","sources":["../../src/Incentives/ERC20VariableCriteriaIncentive.ts"],"sourcesContent":["import {\n erc20VariableCriteriaIncentiveAbi,\n readErc20VariableCriteriaIncentiveGetIncentiveCriteria,\n readErc20VariableCriteriaIncentiveGetMaxReward,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20VariableCriteriaIncentive.sol/ERC20VariableCriteriaIncentive.json';\nimport { getTransaction, getTransactionReceipt } from '@wagmi/core';\nimport {\n type AbiEvent,\n type AbiFunction,\n type Address,\n type Hex,\n decodeAbiParameters,\n decodeFunctionData,\n encodeAbiParameters,\n parseEther,\n parseEventLogs,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20VariableCriteriaIncentive as ERC20VariableCriteriaIncentiveBases } from '../../dist/deployments.json';\nimport { SignatureType } from '../Actions/EventAction';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport {\n DecodedArgsError,\n IncentiveCriteriaNotFoundError,\n InvalidCriteriaTypeError,\n NoMatchingLogsError,\n} from '../errors';\nimport { CheatCodes, type ReadParams } from '../utils';\nimport { ERC20VariableIncentive } from './ERC20VariableIncentive';\n\nexport { erc20VariableCriteriaIncentiveAbi };\n\nexport interface ERC20VariableCriteriaIncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The amount of the asset to distribute as reward.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * The total spending limit of the asset that will be distributed.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * The total amount claimable in a single claim or maximum per-action reward.\n *\n * @type {bigint}\n * @optional\n */\n maxReward?: bigint;\n /**\n * The criteria for the incentive that determines how the reward is distributed.\n *\n * @type {IncentiveCriteria}\n */\n criteria: IncentiveCriteria;\n}\n\nexport interface IncentiveCriteria {\n /**\n * The type of criteria used, either function signature or event signature.\n *\n * @type {SignatureType}\n */\n criteriaType: SignatureType;\n /**\n * The function or event signature used for criteria matching.\n *\n * @type {Hex}\n */\n signature: Hex;\n /**\n * The index of the field from where the scalar value is extracted.\n *\n * @type {number}\n */\n fieldIndex: number;\n /**\n * The address of the contract where the event/function is called/emitted.\n *\n * @type {Address}\n */\n targetContract: Address;\n}\n\nexport interface ReadIncentiveCriteriaParams extends ReadParams {}\n\nexport interface GetIncentiveScalarParams {\n chainId: number;\n hash: Hex;\n knownSignatures: Record<Hex, AbiFunction | AbiEvent>;\n}\n\n/**\n * Extended ERC20 Variable Criteria Incentive class that fetches incentive criteria and scalar\n *\n * @export\n * @deprecated Please use only v2 implementations\n * @class ERC20VariableCriteriaIncentive\n * @typedef {ERC20VariableCriteriaIncentive}\n * @extends {ERC20VariableIncentive<ERC20VariableCriteriaIncentivePayload, typeof erc20VariableCriteriaIncentiveAbi>}\n */\nexport class ERC20VariableCriteriaIncentive extends ERC20VariableIncentive<\n ERC20VariableCriteriaIncentivePayload,\n typeof erc20VariableCriteriaIncentiveAbi,\n Promise<bigint>\n> {\n //@ts-expect-error instantiated correctly\n public override readonly abi = erc20VariableCriteriaIncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n ...(import.meta.env?.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE\n ? { 31337: import.meta.env.VITE_ERC20_VARIABLE_CRITERIA_INCENTIVE_BASE }\n : {}),\n ...(ERC20VariableCriteriaIncentiveBases as Record<number, Address>),\n };\n\n /**\n *Functions from the ERC20VariableIncentive contract\n */\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getIncentiveCriteria(\n params?: ReadParams,\n ): Promise<IncentiveCriteria> {\n try {\n const criteria =\n await readErc20VariableCriteriaIncentiveGetIncentiveCriteria(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return criteria;\n } catch (e) {\n throw new IncentiveCriteriaNotFoundError(e as Error);\n }\n }\n\n /**\n * Decodes claim data for the ERC20VariableCriteriaIncentive, returning the claim amount.\n * Useful when deriving amount claimed from logs.\n *\n * @public\n * @param {Hex} claimData\n * @returns {Promise<bigint>} Returns the reward amount from a claim data payload\n */\n public override async decodeClaimData(claimData: Hex) {\n const boostClaimData = decodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'BoostClaimData',\n components: [\n { type: 'bytes', name: 'validatorData' },\n { type: 'bytes', name: 'incentiveData' },\n ],\n },\n ],\n claimData,\n );\n const signedAmount = decodeAbiParameters(\n [{ type: 'uint256' }],\n boostClaimData[0].incentiveData,\n )[0];\n let claimAmount = signedAmount;\n const [reward, maxReward] = await Promise.all([\n this.reward(),\n this.getMaxReward(),\n ]);\n\n if (reward === 0n) {\n return claimAmount;\n } else {\n claimAmount = (reward * signedAmount) / parseEther('1');\n }\n\n if (maxReward !== 0n && claimAmount > maxReward) {\n claimAmount = maxReward;\n }\n\n return claimAmount;\n }\n\n /**\n * Fetches the IncentiveCriteria struct from the contract\n *\n * @param {?ReadParams} [params]\n * @returns {Promise<IncentiveCriteria>} Incentive criteria structure\n * @throws {IncentiveCriteriaNotFoundError}\n */\n public async getMaxReward(params?: ReadParams): Promise<bigint> {\n const maxReward = await readErc20VariableCriteriaIncentiveGetMaxReward(\n this._config,\n {\n ...params,\n address: this.assertValidAddress(),\n },\n );\n\n return maxReward;\n }\n\n /**\n * Fetches the incentive scalar from a transaction hash\n *\n * @param {GetIncentiveScalarParams} params\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n * @throws {InvalidCriteriaTypeError | NoMatchingLogsError | DecodedArgsError}\n */\n public async getIncentiveScalar(\n { chainId, hash, knownSignatures }: GetIncentiveScalarParams,\n params?: ReadParams,\n ): Promise<bigint> {\n const criteria = await this.getIncentiveCriteria(params);\n if (criteria.criteriaType === SignatureType.EVENT) {\n const transactionReceipt = await getTransactionReceipt(this._config, {\n chainId,\n hash,\n });\n if (criteria.fieldIndex === CheatCodes.GAS_REBATE_INCENTIVE) {\n const totalCost =\n transactionReceipt.gasUsed * transactionReceipt.effectiveGasPrice + // Normal gas cost\n (transactionReceipt.blobGasUsed ?? 0n) *\n (transactionReceipt.blobGasPrice ?? 0n); // Blob gas cost - account for potential undefined values\n return totalCost;\n }\n const logs = transactionReceipt.logs;\n\n if (logs.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n\n // Decode the event log\n try {\n // Decode function data\n const eventAbi = knownSignatures[criteria.signature] as AbiEvent;\n const decodedEvents = parseEventLogs({\n abi: [eventAbi],\n logs,\n });\n if (decodedEvents == undefined || decodedEvents.length === 0) {\n throw new NoMatchingLogsError(\n `No logs found for event signature ${criteria.signature}`,\n );\n }\n const scalarValue = (decodedEvents[0]?.args as string[])[\n criteria.fieldIndex\n ];\n\n if (scalarValue === undefined) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode event log for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else if (criteria.criteriaType === SignatureType.FUNC) {\n // Fetch the transaction data\n const transaction = await getTransaction(this._config, {\n chainId,\n hash,\n });\n try {\n // Decode function data\n const func = knownSignatures[criteria.signature] as AbiFunction;\n const decodedFunction = decodeFunctionData({\n abi: [func],\n data: transaction.input,\n });\n const scalarValue = decodedFunction.args[criteria.fieldIndex] as string;\n if (scalarValue === undefined || scalarValue === null) {\n throw new DecodedArgsError(\n `Decoded argument at index ${criteria.fieldIndex} is undefined`,\n );\n }\n return BigInt(scalarValue);\n } catch (e) {\n throw new DecodedArgsError(\n `Failed to decode function data for signature ${criteria.signature}: ${(e as Error).message}`,\n );\n }\n } else {\n throw new InvalidCriteriaTypeError(\n `Invalid criteria type ${criteria.criteriaType}`,\n );\n }\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20VariableCriteriaIncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20VariableCriteriaIncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20VariableCriteriaIncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20VariableCriteriaIncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n}\n\n/**\n * Creates an IncentiveCriteria object representing a gas rebate incentive.\n * This object defines a variable incentive criteria where the criteria will be the gas spent.\n *\n * The criteria uses a signatureType of EVENT, with a special `fieldIndex` of 255 (using CheatCodes enum), which indicates\n * that the entire gas cost of the transaction will be used as the scalar value. If you don't want to\n * rebate the entire gas cost, you can use a reward value on the incentive..\n *\n * - `criteriaType`: EVENT, indicating it's based on event logs.\n * - `signature`: A zeroed signature (0x0000...0000), matching any event.\n * - `fieldIndex`: 255, indicating the use of transaction gas cost using CheatCodes enum.\n * - `targetContract`: A zeroed address (0x0000...0000), applicable to any contract.\n *\n * @returns {IncentiveCriteria} Returns an IncentiveCriteria object for a gas rebate.\n *\n * @example\n * const incentive = gasRebateIncentiveCriteria();\n * const actionPayload = {\n * criteria: incentive,\n * asset: \"0xAssetAddress\",\n * reward: 0, // Set to zero to rebate the entire gas cost\n * limit: BigInt(1000) // This is the total spend limit for the incentive\n * };\n * deployIncentive(actionPayload);\n */\nexport function gasRebateIncentiveCriteria(): IncentiveCriteria {\n return {\n criteriaType: SignatureType.EVENT,\n signature: zeroHash,\n fieldIndex: CheatCodes.GAS_REBATE_INCENTIVE,\n targetContract: zeroAddress,\n };\n}\n\n/**\n *\n *\n * @param {InitPayloadExtended} param0\n * @param {Address} param0.asset - The address of the ERC20 asset to incentivize.\n * @param {bigint} param0.reward - The reward amount to distribute per action.\n * @param {bigint} param0.limit - The total limit of the asset distribution.\n * @param {bigint} param0.maxReward - The maximum value claimable from a single completion.\n * @param {IncentiveCriteria} param0.criteria - The incentive criteria for reward distribution.\n * @returns {Hex}\n */\nexport function prepareERC20VariableCriteriaIncentivePayload({\n asset,\n reward,\n limit,\n maxReward = 0n,\n criteria,\n}: ERC20VariableCriteriaIncentivePayload) {\n return encodeAbiParameters(\n [\n {\n type: 'tuple',\n name: 'initPayloadExtended',\n components: [\n { type: 'address', name: 'asset' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'uint256', name: 'maxReward' },\n {\n type: 'tuple',\n name: 'criteria',\n components: [\n { type: 'uint8', name: 'criteriaType' },\n { type: 'bytes32', name: 'signature' },\n { type: 'uint8', name: 'fieldIndex' },\n { type: 'address', name: 'targetContract' },\n ],\n },\n ],\n },\n ],\n [\n {\n asset: asset,\n reward: reward,\n limit: limit,\n maxReward: maxReward,\n criteria: {\n criteriaType: criteria.criteriaType,\n signature: criteria.signature,\n fieldIndex: criteria.fieldIndex,\n targetContract: criteria.targetContract,\n },\n },\n ],\n );\n}\n"],"names":["_ERC20VariableCriteriaIncentive","ERC20VariableIncentive","erc20VariableCriteriaIncentiveAbi","params","readErc20VariableCriteriaIncentiveGetIncentiveCriteria","e","IncentiveCriteriaNotFoundError","claimData","boostClaimData","decodeAbiParameters","signedAmount","claimAmount","reward","maxReward","parseEther","readErc20VariableCriteriaIncentiveGetMaxReward","chainId","hash","knownSignatures","criteria","SignatureType","transactionReceipt","getTransactionReceipt","CheatCodes","logs","NoMatchingLogsError","eventAbi","decodedEvents","parseEventLogs","scalarValue","_a","DecodedArgsError","transaction","getTransaction","func","decodeFunctionData","InvalidCriteriaTypeError","_payload","_options","payload","options","bytecode","prepareERC20VariableCriteriaIncentivePayload","__vite_import_meta_env__","ERC20VariableCriteriaIncentiveBases","ERC20VariableCriteriaIncentive","gasRebateIncentiveCriteria","zeroHash","zeroAddress","asset","limit","encodeAbiParameters"],"mappings":";;;;;;;;u1hBAmHaA,IAAN,MAAMA,UAAuCC,EAIlD;AAAA,EAJK,cAAA;AAAA,UAAA,GAAA,SAAA,GAML,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA0B/B,MAAa,qBACXC,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