@boostxyz/sdk 2.0.0-alpha.35 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/Incentives/AllowListIncentive.cjs +1 -1
  2. package/dist/Incentives/AllowListIncentive.cjs.map +1 -1
  3. package/dist/Incentives/AllowListIncentive.d.ts +18 -0
  4. package/dist/Incentives/AllowListIncentive.d.ts.map +1 -1
  5. package/dist/Incentives/AllowListIncentive.js +46 -20
  6. package/dist/Incentives/AllowListIncentive.js.map +1 -1
  7. package/dist/Incentives/CGDAIncentive.cjs +1 -1
  8. package/dist/Incentives/CGDAIncentive.cjs.map +1 -1
  9. package/dist/Incentives/CGDAIncentive.d.ts +18 -0
  10. package/dist/Incentives/CGDAIncentive.d.ts.map +1 -1
  11. package/dist/Incentives/CGDAIncentive.js +55 -24
  12. package/dist/Incentives/CGDAIncentive.js.map +1 -1
  13. package/dist/Incentives/ERC20Incentive.cjs +1 -1
  14. package/dist/Incentives/ERC20Incentive.cjs.map +1 -1
  15. package/dist/Incentives/ERC20Incentive.d.ts +18 -0
  16. package/dist/Incentives/ERC20Incentive.d.ts.map +1 -1
  17. package/dist/Incentives/ERC20Incentive.js +46 -20
  18. package/dist/Incentives/ERC20Incentive.js.map +1 -1
  19. package/dist/Incentives/ERC20VariableIncentive.cjs +1 -1
  20. package/dist/Incentives/ERC20VariableIncentive.cjs.map +1 -1
  21. package/dist/Incentives/ERC20VariableIncentive.d.ts +18 -0
  22. package/dist/Incentives/ERC20VariableIncentive.d.ts.map +1 -1
  23. package/dist/Incentives/ERC20VariableIncentive.js +35 -9
  24. package/dist/Incentives/ERC20VariableIncentive.js.map +1 -1
  25. package/dist/Incentives/PointsIncentive.cjs +1 -1
  26. package/dist/Incentives/PointsIncentive.cjs.map +1 -1
  27. package/dist/Incentives/PointsIncentive.d.ts +18 -0
  28. package/dist/Incentives/PointsIncentive.d.ts.map +1 -1
  29. package/dist/Incentives/PointsIncentive.js +41 -15
  30. package/dist/Incentives/PointsIncentive.js.map +1 -1
  31. package/dist/index.cjs +1 -1
  32. package/dist/index.js +30 -29
  33. package/dist/utils.cjs +1 -1
  34. package/dist/utils.cjs.map +1 -1
  35. package/dist/utils.d.ts +12 -0
  36. package/dist/utils.d.ts.map +1 -1
  37. package/dist/utils.js +64 -35
  38. package/dist/utils.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/Incentives/AllowListIncentive.test.ts +52 -4
  41. package/src/Incentives/AllowListIncentive.ts +28 -0
  42. package/src/Incentives/CGDAIncentive.test.ts +48 -3
  43. package/src/Incentives/CGDAIncentive.ts +34 -0
  44. package/src/Incentives/ERC20Incentive.test.ts +42 -0
  45. package/src/Incentives/ERC20Incentive.ts +28 -0
  46. package/src/Incentives/ERC20VariableIncentive.test.ts +41 -1
  47. package/src/Incentives/ERC20VariableIncentive.ts +28 -0
  48. package/src/Incentives/PointsIncentive.test.ts +47 -3
  49. package/src/Incentives/PointsIncentive.ts +28 -0
  50. package/src/utils.ts +46 -0
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-D3DE5TfH.cjs"),t=require("viem"),y=require("../deployments--f75Pthq.cjs"),u=require("../Deployable/DeployableTarget.cjs"),c=require("../claiming.cjs"),g=require("../utils.cjs"),w="0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550348015610062575f80fd5b5061007161007660201b60201c565b61010b565b5f6100856100e260201b60201c565b90508054600181161561009f5763f92ee8a95f526004601cfd5b8160c01c808260011c146100dd578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b612ca2806101185f395ff3fe608060405260043610610203575f3560e01c806354d1f13d11610117578063c884ef831161009f578063ec87621c1161006e578063ec87621c14610702578063f04e283e1461072c578063f2fde38b14610748578063fe9fbb8014610764578063fee81cf4146107a057610203565b8063c884ef8314610638578063db09da1214610674578063dcc21361146106b0578063dcc59b6f146106d857610203565b8063a4d66daf116100e6578063a4d66daf14610544578063a8c62e761461056e578063b30906d414610598578063bb1757cf146105d4578063be4994f81461061057610203565b806354d1f13d146104dc578063715018a6146104e657806375b238fc146104f05780638da5cb5b1461051a57610203565b806328d6183b1161019a578063439fab9111610169578063439fab91146103e3578063474f5a441461040b5780634a4ee7b1146104485780634e7165a214610464578063514e62fc146104a057610203565b806328d6183b1461032b5780632de948071461035557806338d52e0f146103915780634359d28a146103bb57610203565b80631cd64df4116101d65780631cd64df4146102a55780632275aea9146102e1578063228cb733146102f7578063256929621461032157610203565b806301ffc9a71461020757806307621eca14610243578063183a4f6e1461026d5780631c10893f14610289575b5f80fd5b348015610212575f80fd5b5061022d60048036038101906102289190611e51565b6107dc565b60405161023a9190611e96565b60405180910390f35b34801561024e575f80fd5b50610257610855565b6040516102649190611ec7565b60405180910390f35b61028760048036038101906102829190611f0a565b61085e565b005b6102a3600480360381019061029e9190611f8f565b61086b565b005b3480156102b0575f80fd5b506102cb60048036038101906102c69190611f8f565b610881565b6040516102d89190611e96565b60405180910390f35b3480156102ec575f80fd5b506102f5610897565b005b348015610302575f80fd5b5061030b610a63565b6040516103189190611ec7565b60405180910390f35b610329610a69565b005b348015610336575f80fd5b5061033f610aba565b60405161034c9190611fdc565b60405180910390f35b348015610360575f80fd5b5061037b60048036038101906103769190611ff5565b610ae1565b6040516103889190611ec7565b60405180910390f35b34801561039c575f80fd5b506103a5610afa565b6040516103b2919061202f565b60405180910390f35b3480156103c6575f80fd5b506103e160048036038101906103dc91906120fe565b610b1d565b005b3480156103ee575f80fd5b50610409600480360381019061040491906121d1565b610c2b565b005b348015610416575f80fd5b50610431600480360381019061042c91906121d1565b610e6b565b60405161043f92919061221c565b60405180910390f35b610462600480360381019061045d9190611f8f565b611105565b005b34801561046f575f80fd5b5061048a600480360381019061048591906121d1565b61111b565b60405161049791906122b3565b60405180910390f35b3480156104ab575f80fd5b506104c660048036038101906104c19190611f8f565b611239565b6040516104d39190611e96565b60405180910390f35b6104e4611250565b005b6104ee611289565b005b3480156104fb575f80fd5b5061050461129c565b6040516105119190611ec7565b60405180910390f35b348015610525575f80fd5b5061052e6112a1565b60405161053b919061202f565b60405180910390f35b34801561054f575f80fd5b506105586112c9565b6040516105659190611ec7565b60405180910390f35b348015610579575f80fd5b506105826112cf565b60405161058f9190612346565b60405180910390f35b3480156105a3575f80fd5b506105be60048036038101906105b99190611f0a565b6112e1565b6040516105cb919061202f565b60405180910390f35b3480156105df575f80fd5b506105fa60048036038101906105f5919061235f565b61131c565b6040516106079190611e96565b60405180910390f35b34801561061b575f80fd5b5061063660048036038101906106319190612411565b61160b565b005b348015610643575f80fd5b5061065e60048036038101906106599190611ff5565b6116c1565b60405161066b9190611e96565b60405180910390f35b34801561067f575f80fd5b5061069a6004803603810190610695919061235f565b6116de565b6040516106a79190611e96565b60405180910390f35b3480156106bb575f80fd5b506106d660048036038101906106d19190612411565b6116f1565b005b3480156106e3575f80fd5b506106ec6117a7565b6040516106f99190611ec7565b60405180910390f35b34801561070d575f80fd5b506107166117ad565b6040516107239190611ec7565b60405180910390f35b61074660048036038101906107419190611ff5565b6117b2565b005b610762600480360381019061075d9190611ff5565b6117f0565b005b34801561076f575f80fd5b5061078a60048036038101906107859190611ff5565b611819565b6040516107979190611e96565b60405180910390f35b3480156107ab575f80fd5b506107c660048036038101906107c19190611ff5565b61186c565b6040516107d39190611ec7565b60405180910390f35b5f7f7cc1d5bb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061084e575061084d82611885565b5b9050919050565b5f600254905090565b61086833826118fe565b50565b61087361190d565b61087d8282611944565b5050565b5f818261088d85610ae1565b1614905092915050565b60016108a281611954565b6001808111156108b5576108b46122d3565b5b60045f9054906101000a900460ff1660018111156108d6576108d56122d3565b5b1461090d576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6040518060200160405280424461092591906124bc565b81525090505f6006808054905061093b8461197b565b610945919061251c565b815481106109565761095561254c565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506109cc816002545f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600254604051602001610a3a939291906125de565b604051602081830303815290604052604051610a5691906122b3565b60405180910390a2505050565b60025481565b5f610a726119d3565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f7cc1d5bb00000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6002610b28816119dd565b828290508585905014610b67576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610c23575f848483818110610b8857610b8761254c565b5b9050602002016020810190610b9d9190612644565b90506001151581151503610be257610bdd878784818110610bc157610bc061254c565b5b9050602002016020810190610bd69190611ff5565b6001611944565b610c15565b610c14878784818110610bf857610bf761254c565b5b9050602002016020810190610c0d9190611ff5565b60016118fe565b5b508080600101915050610b69565b505050505050565b5f610c34611a12565b90508054600382558015610c665760018160011c14303b10610c5d5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610c77919061279b565b90505f81604001511480610c8e57505f8160600151145b15610cc5576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600180811115610cd957610cd86122d3565b5b82602001516001811115610cf057610cef6122d3565b5b03610cff578160400151610d14565b81606001518260400151610d1391906127c6565b5b90505f610d4330845f015173ffffffffffffffffffffffffffffffffffffffff16611a3b90919063ffffffff16565b905081811015610d9157825f015181836040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610d8893929190612807565b60405180910390fd5b825f01515f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826020015160045f6101000a81548160ff02191690836001811115610dfb57610dfa6122d3565b5b021790555082604001516002819055508260600151600581905550610e1f33611a6e565b610e2e83608001516001611b44565b5050508015610e66576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f80610e7561190d565b5f8484810190610e859190612955565b90505f8160200151806020019051810190610ea091906129b0565b9050600180811115610eb557610eb46122d3565b5b60045f9054906101000a900460ff166001811115610ed657610ed56122d3565b5b03610f5c5760025481141580610eed57505f600154115b15610f50573382604051602001610f049190612a6c565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610f47929190612a8c565b60405180910390fd5b5f600581905550610ff4565b5f60025482610f6b919061251c565b14610fce573382604051602001610f829190612a6c565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610fc5929190612a8c565b60405180910390fd5b60025481610fdc9190612aba565b60055f828254610fec9190612aea565b925050819055505b611041825f0151825f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f0151846040516020016110b3939291906125de565b6040516020818303038152906040526040516110cf91906122b3565b60405180910390a2805f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350935050509250929050565b61110d61190d565b61111782826118fe565b5050565b60605f838381019061112d919061279b565b90505f600180811115611143576111426122d3565b5b8260200151600181111561115a576111596122d3565b5b0361116957816040015161117e565b8160600151826040015161117d91906127c6565b5b905060405180608001604052806001600281111561119f5761119e6122d3565b5b8152602001835f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff1681526020016040518060200160405280848152506040516020016111fe9190612b46565b6040516020818303038152906040528152506040516020016112209190612c05565b6040516020818303038152906040529250505092915050565b5f808261124585610ae1565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b61129161190d565b61129a5f611b85565b565b600281565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60055481565b60045f9054906101000a900460ff1681565b600681815481106112f0575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f61132561190d565b61132e84611c4b565b611364576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6001811115611377576113766122d3565b5b60045f9054906101000a900460ff166001811115611398576113976122d3565b5b036114f05760015f8154809291906113af90612c25565b9190505550600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550611455846002545f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866002546040516020016114c3939291906125de565b6040516020818303038152906040526040516114df91906122b3565b60405180910390a260019050611604565b60015f81548092919061150290612c25565b9190505550600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600684908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167ff0abe0f5c6f02112a9a4332e7b091bf49040ffddeedb73785a9b9a0a3ca7f15360405160405180910390a2600190505b9392505050565b6002611616816119dd565b828290508585905014611655576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156116b9576116ac8686838181106116785761167761254c565b5b905060200201602081019061168d9190611ff5565b8585848181106116a05761169f61254c565b5b90506020020135611944565b8080600101915050611657565b505050505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b5f6116e884611c4b565b90509392505050565b60026116fc816119dd565b82829050858590501461173b576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8585905081101561179f5761179286868381811061175e5761175d61254c565b5b90506020020160208101906117739190611ff5565b8585848181106117865761178561254c565b5b905060200201356118fe565b808060010191505061173d565b505050505050565b60015481565b600181565b6117ba61190d565b63389a75e1600c52805f526020600c2080544211156117e057636f5e88185f526004601cfd5b5f8155506117ed81611b85565b50565b6117f861190d565b8060601b61180d57637448fbae5f526004601cfd5b61181681611b85565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff166118396112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806118655750611864826002600117611239565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806118f757506118f682611cad565b5b9050919050565b61190982825f611d26565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314611942576382b429005f526004601cfd5b565b61195082826001611d26565b5050565b638b78c6d8600c52335f52806020600c205416611978576382b429005f526004601cfd5b50565b5f602082209050808252919050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f511417166119ca576390b8ec185f526004601cfd5b5f603452505050565b5f6202a300905090565b638b78c6d819543314611a0f57638b78c6d8600c52335f52806020600c205416611a0e576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b611a76611d7e565b15611aee577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415611ab057630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350611b41565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b611b8d611d7e565b15611bf2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550611c48565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f60035f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611ca65750600554600154105b9050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611d1f5750611d1e82611d82565b5b9050919050565b638b78c6d8600c52825f526020600c20805483811783611d4857848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611e3081611dfc565b8114611e3a575f80fd5b50565b5f81359050611e4b81611e27565b92915050565b5f60208284031215611e6657611e65611df4565b5b5f611e7384828501611e3d565b91505092915050565b5f8115159050919050565b611e9081611e7c565b82525050565b5f602082019050611ea95f830184611e87565b92915050565b5f819050919050565b611ec181611eaf565b82525050565b5f602082019050611eda5f830184611eb8565b92915050565b611ee981611eaf565b8114611ef3575f80fd5b50565b5f81359050611f0481611ee0565b92915050565b5f60208284031215611f1f57611f1e611df4565b5b5f611f2c84828501611ef6565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611f5e82611f35565b9050919050565b611f6e81611f54565b8114611f78575f80fd5b50565b5f81359050611f8981611f65565b92915050565b5f8060408385031215611fa557611fa4611df4565b5b5f611fb285828601611f7b565b9250506020611fc385828601611ef6565b9150509250929050565b611fd681611dfc565b82525050565b5f602082019050611fef5f830184611fcd565b92915050565b5f6020828403121561200a57612009611df4565b5b5f61201784828501611f7b565b91505092915050565b61202981611f54565b82525050565b5f6020820190506120425f830184612020565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261206957612068612048565b5b8235905067ffffffffffffffff8111156120865761208561204c565b5b6020830191508360208202830111156120a2576120a1612050565b5b9250929050565b5f8083601f8401126120be576120bd612048565b5b8235905067ffffffffffffffff8111156120db576120da61204c565b5b6020830191508360208202830111156120f7576120f6612050565b5b9250929050565b5f805f806040858703121561211657612115611df4565b5b5f85013567ffffffffffffffff81111561213357612132611df8565b5b61213f87828801612054565b9450945050602085013567ffffffffffffffff81111561216257612161611df8565b5b61216e878288016120a9565b925092505092959194509250565b5f8083601f84011261219157612190612048565b5b8235905067ffffffffffffffff8111156121ae576121ad61204c565b5b6020830191508360018202830111156121ca576121c9612050565b5b9250929050565b5f80602083850312156121e7576121e6611df4565b5b5f83013567ffffffffffffffff81111561220457612203611df8565b5b6122108582860161217c565b92509250509250929050565b5f60408201905061222f5f830185611eb8565b61223c6020830184612020565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61228582612243565b61228f818561224d565b935061229f81856020860161225d565b6122a88161226b565b840191505092915050565b5f6020820190508181035f8301526122cb818461227b565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110612311576123106122d3565b5b50565b5f81905061232182612300565b919050565b5f61233082612314565b9050919050565b61234081612326565b82525050565b5f6020820190506123595f830184612337565b92915050565b5f805f6040848603121561237657612375611df4565b5b5f61238386828701611f7b565b935050602084013567ffffffffffffffff8111156123a4576123a3611df8565b5b6123b08682870161217c565b92509250509250925092565b5f8083601f8401126123d1576123d0612048565b5b8235905067ffffffffffffffff8111156123ee576123ed61204c565b5b60208301915083602082028301111561240a57612409612050565b5b9250929050565b5f805f806040858703121561242957612428611df4565b5b5f85013567ffffffffffffffff81111561244657612445611df8565b5b61245287828801612054565b9450945050602085013567ffffffffffffffff81111561247557612474611df8565b5b612481878288016123bc565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6124c682611eaf565b91506124d183611eaf565b92508282019050808211156124e9576124e861248f565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61252682611eaf565b915061253183611eaf565b925082612541576125406124ef565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8160601b9050919050565b5f61258f82612579565b9050919050565b5f6125a082612585565b9050919050565b6125b86125b382611f54565b612596565b82525050565b5f819050919050565b6125d86125d382611eaf565b6125be565b82525050565b5f6125e982866125a7565b6014820191506125f982856125a7565b60148201915061260982846125c7565b602082019150819050949350505050565b61262381611e7c565b811461262d575f80fd5b50565b5f8135905061263e8161261a565b92915050565b5f6020828403121561265957612658611df4565b5b5f61266684828501612630565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6126a98261226b565b810181811067ffffffffffffffff821117156126c8576126c7612673565b5b80604052505050565b5f6126da611deb565b90506126e682826126a0565b919050565b5f80fd5b600281106126fb575f80fd5b50565b5f8135905061270c816126ef565b92915050565b5f60a082840312156127275761272661266f565b5b61273160a06126d1565b90505f61274084828501611f7b565b5f830152506020612753848285016126fe565b602083015250604061276784828501611ef6565b604083015250606061277b84828501611ef6565b606083015250608061278f84828501611f7b565b60808301525092915050565b5f60a082840312156127b0576127af611df4565b5b5f6127bd84828501612712565b91505092915050565b5f6127d082611eaf565b91506127db83611eaf565b92508282026127e981611eaf565b91508282048414831517612800576127ff61248f565b5b5092915050565b5f60608201905061281a5f830186612020565b6128276020830185611eb8565b6128346040830184611eb8565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561285a57612859612673565b5b6128638261226b565b9050602081019050919050565b828183375f83830152505050565b5f61289061288b84612840565b6126d1565b9050828152602081018484840111156128ac576128ab61283c565b5b6128b7848285612870565b509392505050565b5f82601f8301126128d3576128d2612048565b5b81356128e384826020860161287e565b91505092915050565b5f604082840312156129015761290061266f565b5b61290b60406126d1565b90505f61291a84828501611f7b565b5f83015250602082013567ffffffffffffffff81111561293d5761293c6126eb565b5b612949848285016128bf565b60208301525092915050565b5f6020828403121561296a57612969611df4565b5b5f82013567ffffffffffffffff81111561298757612986611df8565b5b612993848285016128ec565b91505092915050565b5f815190506129aa81611ee0565b92915050565b5f602082840312156129c5576129c4611df4565b5b5f6129d28482850161299c565b91505092915050565b6129e481611f54565b82525050565b5f82825260208201905092915050565b5f612a0482612243565b612a0e81856129ea565b9350612a1e81856020860161225d565b612a278161226b565b840191505092915050565b5f604083015f830151612a475f8601826129db565b5060208301518482036020860152612a5f82826129fa565b9150508091505092915050565b5f6020820190508181035f830152612a848184612a32565b905092915050565b5f604082019050612a9f5f830185612020565b8181036020830152612ab1818461227b565b90509392505050565b5f612ac482611eaf565b9150612acf83611eaf565b925082612adf57612ade6124ef565b5b828204905092915050565b5f612af482611eaf565b9150612aff83611eaf565b9250828203905081811115612b1757612b1661248f565b5b92915050565b612b2681611eaf565b82525050565b602082015f820151612b405f850182612b1d565b50505050565b5f602082019050612b595f830184612b2c565b92915050565b60038110612b7057612b6f6122d3565b5b50565b5f819050612b8082612b5f565b919050565b5f612b8f82612b73565b9050919050565b612b9f81612b85565b82525050565b5f608083015f830151612bba5f860182612b96565b506020830151612bcd60208601826129db565b506040830151612be060408601826129db565b5060608301518482036060860152612bf882826129fa565b9150508091505092915050565b5f6020820190508181035f830152612c1d8184612ba5565b905092915050565b5f612c2f82611eaf565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612c6157612c6061248f565b5b60018201905091905056fea2646970667358221220410c1d04820fa5550ff3aa75a902850d36cca567632e555158b82f613e89f94864736f6c634300081a0033",r=class r extends u.DeployableTarget{constructor(){super(...arguments),this.abi=a.d}async owner(f){return await a.kT(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return await a.ET(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a.CT(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.OT(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.RT(this._config,{address:this.assertValidAddress(),...f})}strategy(f){return a.PT(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return await a.FT(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return await a.LT(this._config,{address:this.assertValidAddress(),...f})}async entries(f,b){return await a.zT(this._config,{address:this.assertValidAddress(),args:[f],...b})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.pA(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.jT(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.uA(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.$T(this._config,e),result:d}}async isClaimable(f,b){return await a.VT(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...b})}async drawRaffle(f){return await this.awaitResult(this.drawRaffleRaw(f))}async drawRaffleRaw(f){const{request:b,result:e}=await a.yA(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...f});return{hash:await a.WT(this._config,b),result:e}}async getTotalBudget(f){var s,n,l;if(((s=this.payload)==null?void 0:s.strategy)!==void 0&&((n=this.payload)==null?void 0:n.limit)!==void 0&&((l=this.payload)==null?void 0:l.reward)!==void 0)return this.payload.strategy===c.StrategyType.POOL?this.payload.limit*this.payload.reward:this.payload.reward;const[b,e,d]=await Promise.all([this.strategy(f),this.limit(f),this.reward(f)]);return b===c.StrategyType.POOL?e*d:d}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.d,bytecode:w,args:[o(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return t.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return t.zeroHash}};r.bases={31337:void 0,...y.ERC20Incentive},r.registryType=g.RegistryType.INCENTIVE;let i=r;function o({asset:h,strategy:f,reward:b,limit:e,manager:d=t.zeroAddress}){return t.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint8",name:"strategy"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"address",name:"manager"}],[h,f,b,e===0n&&f===c.StrategyType.RAFFLE?1n:e,d])}exports.erc20IncentiveAbi=a.d;exports.ERC20Incentive=i;exports.prepareERC20IncentivePayload=o;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../generated-D3DE5TfH.cjs"),s=require("viem"),y=require("../deployments--f75Pthq.cjs"),u=require("../Deployable/DeployableTarget.cjs"),c=require("../claiming.cjs"),g=require("../utils.cjs"),w="0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550348015610062575f80fd5b5061007161007660201b60201c565b61010b565b5f6100856100e260201b60201c565b90508054600181161561009f5763f92ee8a95f526004601cfd5b8160c01c808260011c146100dd578060011b8355806020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b612ca2806101185f395ff3fe608060405260043610610203575f3560e01c806354d1f13d11610117578063c884ef831161009f578063ec87621c1161006e578063ec87621c14610702578063f04e283e1461072c578063f2fde38b14610748578063fe9fbb8014610764578063fee81cf4146107a057610203565b8063c884ef8314610638578063db09da1214610674578063dcc21361146106b0578063dcc59b6f146106d857610203565b8063a4d66daf116100e6578063a4d66daf14610544578063a8c62e761461056e578063b30906d414610598578063bb1757cf146105d4578063be4994f81461061057610203565b806354d1f13d146104dc578063715018a6146104e657806375b238fc146104f05780638da5cb5b1461051a57610203565b806328d6183b1161019a578063439fab9111610169578063439fab91146103e3578063474f5a441461040b5780634a4ee7b1146104485780634e7165a214610464578063514e62fc146104a057610203565b806328d6183b1461032b5780632de948071461035557806338d52e0f146103915780634359d28a146103bb57610203565b80631cd64df4116101d65780631cd64df4146102a55780632275aea9146102e1578063228cb733146102f7578063256929621461032157610203565b806301ffc9a71461020757806307621eca14610243578063183a4f6e1461026d5780631c10893f14610289575b5f80fd5b348015610212575f80fd5b5061022d60048036038101906102289190611e51565b6107dc565b60405161023a9190611e96565b60405180910390f35b34801561024e575f80fd5b50610257610855565b6040516102649190611ec7565b60405180910390f35b61028760048036038101906102829190611f0a565b61085e565b005b6102a3600480360381019061029e9190611f8f565b61086b565b005b3480156102b0575f80fd5b506102cb60048036038101906102c69190611f8f565b610881565b6040516102d89190611e96565b60405180910390f35b3480156102ec575f80fd5b506102f5610897565b005b348015610302575f80fd5b5061030b610a63565b6040516103189190611ec7565b60405180910390f35b610329610a69565b005b348015610336575f80fd5b5061033f610aba565b60405161034c9190611fdc565b60405180910390f35b348015610360575f80fd5b5061037b60048036038101906103769190611ff5565b610ae1565b6040516103889190611ec7565b60405180910390f35b34801561039c575f80fd5b506103a5610afa565b6040516103b2919061202f565b60405180910390f35b3480156103c6575f80fd5b506103e160048036038101906103dc91906120fe565b610b1d565b005b3480156103ee575f80fd5b50610409600480360381019061040491906121d1565b610c2b565b005b348015610416575f80fd5b50610431600480360381019061042c91906121d1565b610e6b565b60405161043f92919061221c565b60405180910390f35b610462600480360381019061045d9190611f8f565b611105565b005b34801561046f575f80fd5b5061048a600480360381019061048591906121d1565b61111b565b60405161049791906122b3565b60405180910390f35b3480156104ab575f80fd5b506104c660048036038101906104c19190611f8f565b611239565b6040516104d39190611e96565b60405180910390f35b6104e4611250565b005b6104ee611289565b005b3480156104fb575f80fd5b5061050461129c565b6040516105119190611ec7565b60405180910390f35b348015610525575f80fd5b5061052e6112a1565b60405161053b919061202f565b60405180910390f35b34801561054f575f80fd5b506105586112c9565b6040516105659190611ec7565b60405180910390f35b348015610579575f80fd5b506105826112cf565b60405161058f9190612346565b60405180910390f35b3480156105a3575f80fd5b506105be60048036038101906105b99190611f0a565b6112e1565b6040516105cb919061202f565b60405180910390f35b3480156105df575f80fd5b506105fa60048036038101906105f5919061235f565b61131c565b6040516106079190611e96565b60405180910390f35b34801561061b575f80fd5b5061063660048036038101906106319190612411565b61160b565b005b348015610643575f80fd5b5061065e60048036038101906106599190611ff5565b6116c1565b60405161066b9190611e96565b60405180910390f35b34801561067f575f80fd5b5061069a6004803603810190610695919061235f565b6116de565b6040516106a79190611e96565b60405180910390f35b3480156106bb575f80fd5b506106d660048036038101906106d19190612411565b6116f1565b005b3480156106e3575f80fd5b506106ec6117a7565b6040516106f99190611ec7565b60405180910390f35b34801561070d575f80fd5b506107166117ad565b6040516107239190611ec7565b60405180910390f35b61074660048036038101906107419190611ff5565b6117b2565b005b610762600480360381019061075d9190611ff5565b6117f0565b005b34801561076f575f80fd5b5061078a60048036038101906107859190611ff5565b611819565b6040516107979190611e96565b60405180910390f35b3480156107ab575f80fd5b506107c660048036038101906107c19190611ff5565b61186c565b6040516107d39190611ec7565b60405180910390f35b5f7f7cc1d5bb000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916148061084e575061084d82611885565b5b9050919050565b5f600254905090565b61086833826118fe565b50565b61087361190d565b61087d8282611944565b5050565b5f818261088d85610ae1565b1614905092915050565b60016108a281611954565b6001808111156108b5576108b46122d3565b5b60045f9054906101000a900460ff1660018111156108d6576108d56122d3565b5b1461090d576040517f82b4290000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6040518060200160405280424461092591906124bc565b81525090505f6006808054905061093b8461197b565b610945919061251c565b815481106109565761095561254c565b5b905f5260205f20015f9054906101000a900473ffffffffffffffffffffffffffffffffffffffff1690506109cc816002545f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1683600254604051602001610a3a939291906125de565b604051602081830303815290604052604051610a5691906122b3565b60405180910390a2505050565b60025481565b5f610a726119d3565b67ffffffffffffffff164201905063389a75e1600c52335f52806020600c2055337fdbf36a107da19e49527a7176a1babf963b4b0ff8cde35ee35d6cd8f1f9ac7e1d5f80a250565b5f7f7cc1d5bb00000000000000000000000000000000000000000000000000000000905090565b5f638b78c6d8600c52815f526020600c20549050919050565b5f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6002610b28816119dd565b828290508585905014610b67576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b85859050811015610c23575f848483818110610b8857610b8761254c565b5b9050602002016020810190610b9d9190612644565b90506001151581151503610be257610bdd878784818110610bc157610bc061254c565b5b9050602002016020810190610bd69190611ff5565b6001611944565b610c15565b610c14878784818110610bf857610bf761254c565b5b9050602002016020810190610c0d9190611ff5565b60016118fe565b5b508080600101915050610b69565b505050505050565b5f610c34611a12565b90508054600382558015610c665760018160011c14303b10610c5d5763f92ee8a95f526004601cfd5b818160ff1b1b91505b505f8383810190610c77919061279b565b90505f81604001511480610c8e57505f8160600151145b15610cc5576040517ff92ee8a900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f600180811115610cd957610cd86122d3565b5b82602001516001811115610cf057610cef6122d3565b5b03610cff578160400151610d14565b81606001518260400151610d1391906127c6565b5b90505f610d4330845f015173ffffffffffffffffffffffffffffffffffffffff16611a3b90919063ffffffff16565b905081811015610d9157825f015181836040517f5c54305e000000000000000000000000000000000000000000000000000000008152600401610d8893929190612807565b60405180910390fd5b825f01515f806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550826020015160045f6101000a81548160ff02191690836001811115610dfb57610dfa6122d3565b5b021790555082604001516002819055508260600151600581905550610e1f33611a6e565b610e2e83608001516001611b44565b5050508015610e66576002815560016020527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d2602080a15b505050565b5f80610e7561190d565b5f8484810190610e859190612955565b90505f8160200151806020019051810190610ea091906129b0565b9050600180811115610eb557610eb46122d3565b5b60045f9054906101000a900460ff166001811115610ed657610ed56122d3565b5b03610f5c5760025481141580610eed57505f600154115b15610f50573382604051602001610f049190612a6c565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610f47929190612a8c565b60405180910390fd5b5f600581905550610ff4565b5f60025482610f6b919061251c565b14610fce573382604051602001610f829190612a6c565b6040516020818303038152906040526040517f4139d81d000000000000000000000000000000000000000000000000000000008152600401610fc5929190612a8c565b60405180910390fd5b60025481610fdc9190612aba565b60055f828254610fec9190612aea565b925050819055505b611041825f0151825f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b815f015173ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16845f0151846040516020016110b3939291906125de565b6040516020818303038152906040526040516110cf91906122b3565b60405180910390a2805f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff169350935050509250929050565b61110d61190d565b61111782826118fe565b5050565b60605f838381019061112d919061279b565b90505f600180811115611143576111426122d3565b5b8260200151600181111561115a576111596122d3565b5b0361116957816040015161117e565b8160600151826040015161117d91906127c6565b5b905060405180608001604052806001600281111561119f5761119e6122d3565b5b8152602001835f015173ffffffffffffffffffffffffffffffffffffffff1681526020013073ffffffffffffffffffffffffffffffffffffffff1681526020016040518060200160405280848152506040516020016111fe9190612b46565b6040516020818303038152906040528152506040516020016112209190612c05565b6040516020818303038152906040529250505092915050565b5f808261124585610ae1565b161415905092915050565b63389a75e1600c52335f525f6020600c2055337ffa7b8eab7da67f412cc9575ed43464468f9bfbae89d1675917346ca6d8fe3c925f80a2565b61129161190d565b61129a5f611b85565b565b600281565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392754905090565b60055481565b60045f9054906101000a900460ff1681565b600681815481106112f0575f80fd5b905f5260205f20015f915054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b5f61132561190d565b61132e84611c4b565b611364576040517f6247a84e00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6001811115611377576113766122d3565b5b60045f9054906101000a900460ff166001811115611398576113976122d3565b5b036114f05760015f8154809291906113af90612c25565b9190505550600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550611455846002545f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1661198a9092919063ffffffff16565b8373ffffffffffffffffffffffffffffffffffffffff167f9ad2e7a4af16dceda9cce4274b2f59c328d8c012eb0e15eb5e1e73b7d8f264d35f8054906101000a900473ffffffffffffffffffffffffffffffffffffffff16866002546040516020016114c3939291906125de565b6040516020818303038152906040526040516114df91906122b3565b60405180910390a260019050611604565b60015f81548092919061150290612c25565b9190505550600160035f8673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f6101000a81548160ff021916908315150217905550600684908060018154018082558091505060019003905f5260205f20015f9091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508373ffffffffffffffffffffffffffffffffffffffff167ff0abe0f5c6f02112a9a4332e7b091bf49040ffddeedb73785a9b9a0a3ca7f15360405160405180910390a2600190505b9392505050565b6002611616816119dd565b828290508585905014611655576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b858590508110156116b9576116ac8686838181106116785761167761254c565b5b905060200201602081019061168d9190611ff5565b8585848181106116a05761169f61254c565b5b90506020020135611944565b8080600101915050611657565b505050505050565b6003602052805f5260405f205f915054906101000a900460ff1681565b5f6116e884611c4b565b90509392505050565b60026116fc816119dd565b82829050858590501461173b576040517fff633a3800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5b8585905081101561179f5761179286868381811061175e5761175d61254c565b5b90506020020160208101906117739190611ff5565b8585848181106117865761178561254c565b5b905060200201356118fe565b808060010191505061173d565b505050505050565b60015481565b600181565b6117ba61190d565b63389a75e1600c52805f526020600c2080544211156117e057636f5e88185f526004601cfd5b5f8155506117ed81611b85565b50565b6117f861190d565b8060601b61180d57637448fbae5f526004601cfd5b61181681611b85565b50565b5f8173ffffffffffffffffffffffffffffffffffffffff166118396112a1565b73ffffffffffffffffffffffffffffffffffffffff1614806118655750611864826002600117611239565b5b9050919050565b5f63389a75e1600c52815f526020600c20549050919050565b5f7fa9216705000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191614806118f757506118f682611cad565b5b9050919050565b61190982825f611d26565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927543314611942576382b429005f526004601cfd5b565b61195082826001611d26565b5050565b638b78c6d8600c52335f52806020600c205416611978576382b429005f526004601cfd5b50565b5f602082209050808252919050565b81601452806034526fa9059cbb0000000000000000000000005f5260205f604460105f875af13d1560015f511417166119ca576390b8ec185f526004601cfd5b5f603452505050565b5f6202a300905090565b638b78c6d819543314611a0f57638b78c6d8600c52335f52806020600c205416611a0e576382b429005f526004601cfd5b5b50565b5f7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffbf6011325f1b905090565b5f816014526f70a082310000000000000000000000005f5260208060246010865afa601f3d111660205102905092915050565b611a76611d7e565b15611aee577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff74873927805415611ab057630dc149f05f526004601cfd5b8160601b60601c9150811560ff1b82178155815f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a350611b41565b8060601b60601c9050807fffffffffffffffffffffffffffffffffffffffffffffffffffffffff7487392755805f7f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a35b50565b638b78c6d8600c52815f52806020600c205580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a35050565b611b8d611d7e565b15611bf2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3811560ff1b8217815550611c48565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffff748739278160601b60601c91508181547f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e05f80a3818155505b50565b5f60035f8373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020015f205f9054906101000a900460ff16158015611ca65750600554600154105b9050919050565b5f7f6ab67a0d000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19161480611d1f5750611d1e82611d82565b5b9050919050565b638b78c6d8600c52825f526020600c20805483811783611d4857848216821890505b80835580600c5160601c7f715ad5ce61fc9595c7b415289d59cf203f23a94fa06f04af7e489a0a76e1fe265f80a3505050505050565b5f90565b5f7f01ffc9a7000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916149050919050565b5f604051905090565b5f80fd5b5f80fd5b5f7fffffffff0000000000000000000000000000000000000000000000000000000082169050919050565b611e3081611dfc565b8114611e3a575f80fd5b50565b5f81359050611e4b81611e27565b92915050565b5f60208284031215611e6657611e65611df4565b5b5f611e7384828501611e3d565b91505092915050565b5f8115159050919050565b611e9081611e7c565b82525050565b5f602082019050611ea95f830184611e87565b92915050565b5f819050919050565b611ec181611eaf565b82525050565b5f602082019050611eda5f830184611eb8565b92915050565b611ee981611eaf565b8114611ef3575f80fd5b50565b5f81359050611f0481611ee0565b92915050565b5f60208284031215611f1f57611f1e611df4565b5b5f611f2c84828501611ef6565b91505092915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f611f5e82611f35565b9050919050565b611f6e81611f54565b8114611f78575f80fd5b50565b5f81359050611f8981611f65565b92915050565b5f8060408385031215611fa557611fa4611df4565b5b5f611fb285828601611f7b565b9250506020611fc385828601611ef6565b9150509250929050565b611fd681611dfc565b82525050565b5f602082019050611fef5f830184611fcd565b92915050565b5f6020828403121561200a57612009611df4565b5b5f61201784828501611f7b565b91505092915050565b61202981611f54565b82525050565b5f6020820190506120425f830184612020565b92915050565b5f80fd5b5f80fd5b5f80fd5b5f8083601f84011261206957612068612048565b5b8235905067ffffffffffffffff8111156120865761208561204c565b5b6020830191508360208202830111156120a2576120a1612050565b5b9250929050565b5f8083601f8401126120be576120bd612048565b5b8235905067ffffffffffffffff8111156120db576120da61204c565b5b6020830191508360208202830111156120f7576120f6612050565b5b9250929050565b5f805f806040858703121561211657612115611df4565b5b5f85013567ffffffffffffffff81111561213357612132611df8565b5b61213f87828801612054565b9450945050602085013567ffffffffffffffff81111561216257612161611df8565b5b61216e878288016120a9565b925092505092959194509250565b5f8083601f84011261219157612190612048565b5b8235905067ffffffffffffffff8111156121ae576121ad61204c565b5b6020830191508360018202830111156121ca576121c9612050565b5b9250929050565b5f80602083850312156121e7576121e6611df4565b5b5f83013567ffffffffffffffff81111561220457612203611df8565b5b6122108582860161217c565b92509250509250929050565b5f60408201905061222f5f830185611eb8565b61223c6020830184612020565b9392505050565b5f81519050919050565b5f82825260208201905092915050565b8281835e5f83830152505050565b5f601f19601f8301169050919050565b5f61228582612243565b61228f818561224d565b935061229f81856020860161225d565b6122a88161226b565b840191505092915050565b5f6020820190508181035f8301526122cb818461227b565b905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52602160045260245ffd5b60028110612311576123106122d3565b5b50565b5f81905061232182612300565b919050565b5f61233082612314565b9050919050565b61234081612326565b82525050565b5f6020820190506123595f830184612337565b92915050565b5f805f6040848603121561237657612375611df4565b5b5f61238386828701611f7b565b935050602084013567ffffffffffffffff8111156123a4576123a3611df8565b5b6123b08682870161217c565b92509250509250925092565b5f8083601f8401126123d1576123d0612048565b5b8235905067ffffffffffffffff8111156123ee576123ed61204c565b5b60208301915083602082028301111561240a57612409612050565b5b9250929050565b5f805f806040858703121561242957612428611df4565b5b5f85013567ffffffffffffffff81111561244657612445611df8565b5b61245287828801612054565b9450945050602085013567ffffffffffffffff81111561247557612474611df8565b5b612481878288016123bc565b925092505092959194509250565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601160045260245ffd5b5f6124c682611eaf565b91506124d183611eaf565b92508282019050808211156124e9576124e861248f565b5b92915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52601260045260245ffd5b5f61252682611eaf565b915061253183611eaf565b925082612541576125406124ef565b5b828206905092915050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f8160601b9050919050565b5f61258f82612579565b9050919050565b5f6125a082612585565b9050919050565b6125b86125b382611f54565b612596565b82525050565b5f819050919050565b6125d86125d382611eaf565b6125be565b82525050565b5f6125e982866125a7565b6014820191506125f982856125a7565b60148201915061260982846125c7565b602082019150819050949350505050565b61262381611e7c565b811461262d575f80fd5b50565b5f8135905061263e8161261a565b92915050565b5f6020828403121561265957612658611df4565b5b5f61266684828501612630565b91505092915050565b5f80fd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b6126a98261226b565b810181811067ffffffffffffffff821117156126c8576126c7612673565b5b80604052505050565b5f6126da611deb565b90506126e682826126a0565b919050565b5f80fd5b600281106126fb575f80fd5b50565b5f8135905061270c816126ef565b92915050565b5f60a082840312156127275761272661266f565b5b61273160a06126d1565b90505f61274084828501611f7b565b5f830152506020612753848285016126fe565b602083015250604061276784828501611ef6565b604083015250606061277b84828501611ef6565b606083015250608061278f84828501611f7b565b60808301525092915050565b5f60a082840312156127b0576127af611df4565b5b5f6127bd84828501612712565b91505092915050565b5f6127d082611eaf565b91506127db83611eaf565b92508282026127e981611eaf565b91508282048414831517612800576127ff61248f565b5b5092915050565b5f60608201905061281a5f830186612020565b6128276020830185611eb8565b6128346040830184611eb8565b949350505050565b5f80fd5b5f67ffffffffffffffff82111561285a57612859612673565b5b6128638261226b565b9050602081019050919050565b828183375f83830152505050565b5f61289061288b84612840565b6126d1565b9050828152602081018484840111156128ac576128ab61283c565b5b6128b7848285612870565b509392505050565b5f82601f8301126128d3576128d2612048565b5b81356128e384826020860161287e565b91505092915050565b5f604082840312156129015761290061266f565b5b61290b60406126d1565b90505f61291a84828501611f7b565b5f83015250602082013567ffffffffffffffff81111561293d5761293c6126eb565b5b612949848285016128bf565b60208301525092915050565b5f6020828403121561296a57612969611df4565b5b5f82013567ffffffffffffffff81111561298757612986611df8565b5b612993848285016128ec565b91505092915050565b5f815190506129aa81611ee0565b92915050565b5f602082840312156129c5576129c4611df4565b5b5f6129d28482850161299c565b91505092915050565b6129e481611f54565b82525050565b5f82825260208201905092915050565b5f612a0482612243565b612a0e81856129ea565b9350612a1e81856020860161225d565b612a278161226b565b840191505092915050565b5f604083015f830151612a475f8601826129db565b5060208301518482036020860152612a5f82826129fa565b9150508091505092915050565b5f6020820190508181035f830152612a848184612a32565b905092915050565b5f604082019050612a9f5f830185612020565b8181036020830152612ab1818461227b565b90509392505050565b5f612ac482611eaf565b9150612acf83611eaf565b925082612adf57612ade6124ef565b5b828204905092915050565b5f612af482611eaf565b9150612aff83611eaf565b9250828203905081811115612b1757612b1661248f565b5b92915050565b612b2681611eaf565b82525050565b602082015f820151612b405f850182612b1d565b50505050565b5f602082019050612b595f830184612b2c565b92915050565b60038110612b7057612b6f6122d3565b5b50565b5f819050612b8082612b5f565b919050565b5f612b8f82612b73565b9050919050565b612b9f81612b85565b82525050565b5f608083015f830151612bba5f860182612b96565b506020830151612bcd60208601826129db565b506040830151612be060408601826129db565b5060608301518482036060860152612bf882826129fa565b9150508091505092915050565b5f6020820190508181035f830152612c1d8184612ba5565b905092915050565b5f612c2f82611eaf565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203612c6157612c6061248f565b5b60018201905091905056fea2646970667358221220410c1d04820fa5550ff3aa75a902850d36cca567632e555158b82f613e89f94864736f6c634300081a0033",i=class i extends u.DeployableTarget{constructor(){super(...arguments),this.abi=a.d}async owner(f){return await a.kT(this._config,{address:this.assertValidAddress(),args:[],...f})}async currentReward(f){return await a.ET(this._config,{address:this.assertValidAddress(),args:[],...f})}async claims(f){return await a.CT(this._config,{address:this.assertValidAddress(),args:[],...f})}async claimed(f,b){return await a.OT(this._config,{address:this.assertValidAddress(),args:[f],...b})}async asset(f){return await a.RT(this._config,{address:this.assertValidAddress(),...f})}strategy(f){return a.PT(this._config,{address:this.assertValidAddress(),...f})}async reward(f){return await a.FT(this._config,{address:this.assertValidAddress(),...f})}async limit(f){return await a.LT(this._config,{address:this.assertValidAddress(),...f})}async entries(f,b){return await a.zT(this._config,{address:this.assertValidAddress(),args:[f],...b})}async claim(f,b){return await this.awaitResult(this.claimRaw(f,b))}async claimRaw(f,b){const{request:e,result:d}=await a.pA(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.jT(this._config,e),result:d}}async clawback(f,b){return await this.awaitResult(this.clawbackRaw(f,b))}async clawbackRaw(f,b){const{request:e,result:d}=await a.uA(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...this.optionallyAttachAccount(),...b});return{hash:await a.$T(this._config,e),result:d}}async isClaimable(f,b){return await a.VT(this._config,{address:this.assertValidAddress(),args:[c.prepareClaimPayload(f)],...b})}async drawRaffle(f){return await this.awaitResult(this.drawRaffleRaw(f))}async drawRaffleRaw(f){const{request:b,result:e}=await a.yA(this._config,{address:this.assertValidAddress(),...this.optionallyAttachAccount(),...f});return{hash:await a.WT(this._config,b),result:e}}async getTotalBudget(f){var t,n,l;if(((t=this.payload)==null?void 0:t.strategy)!==void 0&&((n=this.payload)==null?void 0:n.limit)!==void 0&&((l=this.payload)==null?void 0:l.reward)!==void 0)return this.payload.strategy===c.StrategyType.POOL?this.payload.limit*this.payload.reward:this.payload.reward;const[b,e,d]=await Promise.all([this.strategy(f),this.limit(f),this.reward(f)]);return b===c.StrategyType.POOL?e*d:d}async canBeClaimed(f){return await this.getRemainingClaimPotential(f)>0n}async getRemainingClaimPotential(f){const[b,e]=await Promise.all([this.claims(f),this.limit(f)]);return e-b}buildParameters(f,b){const[e,d]=this.validateDeploymentConfig(f,b);return{abi:a.d,bytecode:w,args:[o(e)],...this.optionallyAttachAccount(d.account)}}buildClawbackData(f){return s.encodeAbiParameters([{type:"uint256"}],[f])}buildClaimData(){return s.zeroHash}};i.bases={31337:void 0,...y.ERC20Incentive},i.registryType=g.RegistryType.INCENTIVE;let r=i;function o({asset:h,strategy:f,reward:b,limit:e,manager:d=s.zeroAddress}){return s.encodeAbiParameters([{type:"address",name:"asset"},{type:"uint8",name:"strategy"},{type:"uint256",name:"reward"},{type:"uint256",name:"limit"},{type:"address",name:"manager"}],[h,f,b,e===0n&&f===c.StrategyType.RAFFLE?1n:e,d])}exports.erc20IncentiveAbi=a.d;exports.ERC20Incentive=r;exports.prepareERC20IncentivePayload=o;
2
2
  //# sourceMappingURL=ERC20Incentive.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20Incentive.cjs","sources":["../../src/Incentives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n StrategyType,\n prepareClaimPayload,\n} from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\n\n/**\n * The object representation of a `ERC20Incentive.InitPayload`\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive.\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed. This should ideally be 1n for `RAFFLE` strategy types.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can trigger a raffle.\n * If omitted, the incentive will have no manager with permissions to draw the raffle.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20IncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20IncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20IncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<StrategyType>}\n */\n public strategy(params?: ReadParams): Promise<StrategyType> {\n return readErc20IncentiveStrategy(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20IncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async entries(i: bigint, params?: ReadParams) {\n return await readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(params?: WriteParams) {\n return await this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async drawRaffleRaw(params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (\n this.payload?.strategy !== undefined &&\n this.payload?.limit !== undefined &&\n this.payload?.reward !== undefined\n ) {\n return (this.payload.strategy as StrategyType) === StrategyType.POOL\n ? this.payload.limit * this.payload.reward\n : this.payload.reward;\n }\n const [strategy, limit, reward] = await Promise.all([\n this.strategy(params),\n this.limit(params),\n this.reward(params),\n ]);\n return strategy === StrategyType.POOL ? limit * reward : reward;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20Incentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as ERC20Incentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because ERC20Incentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link ERC20IncentivePayload}, properly encode a `ERC20Incentive.InitPayload` for use with {@link ERC20Incentive} initialization.\n *\n * @param {ERC20IncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can draw raffles - defaults to unset\n * @returns {Hex}\n */\nexport function prepareERC20IncentivePayload({\n asset,\n strategy,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20IncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint8', name: 'strategy' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [\n asset,\n strategy,\n reward,\n // unclear how user set limit should work for raffle, so in order to avoid passing 0's let's correct it\n limit === 0n && strategy === StrategyType.RAFFLE ? 1n : limit,\n manager,\n ],\n );\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_a","_b","_c","StrategyType","strategy","limit","reward","_payload","_options","options","bytecode","prepareERC20IncentivePayload","amount","encodeAbiParameters","zeroHash","ERC20IncentiveBases","RegistryType","ERC20Incentive","asset","manager","zeroAddress"],"mappings":"0puBAiHaA,EAAN,MAAMA,UAAuBC,EAAAA,gBAGlC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAAwB,KAAK,QAAS,CACjD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,cAAcA,EAAqB,CACvC,OAAA,MAAME,EAAAA,GAAgC,KAAK,QAAS,CACzD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAMG,EAAAA,GAAyB,KAAK,QAAS,CAClD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,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entives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n StrategyType,\n prepareClaimPayload,\n} from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\n\n/**\n * The object representation of a `ERC20Incentive.InitPayload`\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive.\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed. This should ideally be 1n for `RAFFLE` strategy types.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can trigger a raffle.\n * If omitted, the incentive will have no manager with permissions to draw the raffle.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20IncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20IncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20IncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<StrategyType>}\n */\n public strategy(params?: ReadParams): Promise<StrategyType> {\n return readErc20IncentiveStrategy(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20IncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async entries(i: bigint, params?: ReadParams) {\n return await readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(params?: WriteParams) {\n return await this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async drawRaffleRaw(params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (\n this.payload?.strategy !== undefined &&\n this.payload?.limit !== undefined &&\n this.payload?.reward !== undefined\n ) {\n return (this.payload.strategy as StrategyType) === StrategyType.POOL\n ? this.payload.limit * this.payload.reward\n : this.payload.reward;\n }\n const [strategy, limit, reward] = await Promise.all([\n this.strategy(params),\n this.limit(params),\n this.reward(params),\n ]);\n return strategy === StrategyType.POOL ? limit * reward : reward;\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20Incentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as ERC20Incentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because ERC20Incentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link ERC20IncentivePayload}, properly encode a `ERC20Incentive.InitPayload` for use with {@link ERC20Incentive} initialization.\n *\n * @param {ERC20IncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can draw raffles - defaults to unset\n * @returns {Hex}\n */\nexport function prepareERC20IncentivePayload({\n asset,\n strategy,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20IncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint8', name: 'strategy' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [\n asset,\n strategy,\n reward,\n // unclear how user set limit should work for raffle, so in order to avoid passing 0's let's correct it\n limit === 0n && strategy === StrategyType.RAFFLE ? 1n : limit,\n manager,\n ],\n );\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_a","_b","_c","StrategyType","strategy","limit","reward","claims","_payload","_options","options","bytecode","prepareERC20IncentivePayload","amount","encodeAbiParameters","zeroHash","ERC20IncentiveBases","RegistryType","ERC20Incentive","asset","manager","zeroAddress"],"mappings":"0puBAiHaA,EAAN,MAAMA,UAAuBC,EAAAA,gBAGlC,CAHK,aAAA,CAAA,MAAA,GAAA,SAAA,EAIL,KAAyB,IAAMC,GAAA,CA6B/B,MAAa,MAAMC,EAAqB,CAC/B,OAAA,MAAMC,EAAAA,GAAwB,KAAK,QAAS,CACjD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAID,CAAA,CACL,CACH,CAUA,MAAa,cAAcA,EAAqB,CACvC,OAAA,MAAME,EAAAA,GAAgC,KAAK,QAAS,CACzD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIF,CAAA,CACL,CACH,CAUA,MAAa,OAAOA,EAAqB,CAChC,OAAA,MAAMG,EAAAA,GAAyB,KAAK,QAAS,CAClD,QAAS,KAAK,mBAAmB,EACjC,KAAM,CAAC,EAEP,GAAIH,CAAA,CACL,CACH,CAWA,MAAa,QAAQI,EAAkBJ,EAAqB,CACnD,OAAA,MAAMK,EAAAA,G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AAM,UAAW,KAAM,SAAU,CACrC,EACA,CACEK,EACAf,EACAE,EAEAD,IAAU,IAAMD,IAAaD,EAAA,aAAa,OAAS,GAAKE,EACxDe,CACF,CAAA,CAEJ"}
@@ -846,6 +846,24 @@ export declare class ERC20Incentive extends DeployableTarget<ERC20IncentivePaylo
846
846
  * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.
847
847
  */
848
848
  getTotalBudget(params?: ReadParams): Promise<bigint>;
849
+ /**
850
+ * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
851
+ *
852
+ * @public
853
+ * @async
854
+ * @param {?ReadParams} [params]
855
+ * @returns {Promise<boolean>} - True if total claims is less than limit
856
+ */
857
+ canBeClaimed(params?: ReadParams): Promise<boolean>;
858
+ /**
859
+ * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
860
+ *
861
+ * @public
862
+ * @async
863
+ * @param {?ReadParams} [params]
864
+ * @returns {Promise<bigint>} - True if total claims is less than limit
865
+ */
866
+ getRemainingClaimPotential(params?: ReadParams): Promise<bigint>;
849
867
  /**
850
868
  * @inheritdoc
851
869
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20Incentive.d.ts","sourceRoot":"","sources":["../../src/Incentives/ERC20Incentive.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EAiBlB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAKvB,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EACL,KAAK,YAAY,EACjB,YAAY,EAEb,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,KAAK,UAAU,EACf,KAAK,UAAU,EACf,YAAY,EACZ,KAAK,WAAW,EACjB,MAAM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AAC,EAAE,UAAU;IASnE;;;;;;;OAOG;IACU,UAAU,CAAC,MAAM,CAAC,EAAE,WAAW;IAI5C;;;;;;;OAOG;IACU,aAAa,CAAC,MAAM,CAAC,EAAE,WAAW;;;;IAc/C;;;;;;;OAOG;IACU,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU;IAkB/C;;;;;;;OAOG;IACU,YAAY,CAAC,MAAM,CAAC,EAAE,UAAU;IAI7C;;;;;;;OAOG;IACU,0BAA0B,CAAC,MAAM,CAAC,EAAE,UAAU;IAQ3D;;;;;;;OAOG;IACa,eAAe,CAC7B,QAAQ,CAAC,EAAE,qBAAqB,EAChC,QAAQ,CAAC,EAAE,iBAAiB,GAC3B,uBAAuB;IAa1B;;;;;;OAMG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM;IAIvC;;;;;;OAMG;IACI,cAAc;CAGtB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,EAC3C,KAAK,EACL,QAAQ,EACR,MAAM,EACN,KAAK,EACL,OAAqB,GACtB,EAAE,qBAAqB,iBAkBvB"}
@@ -1,5 +1,5 @@
1
- import { d as n, ay as y, az as u, aA as w, aB as g, aC as p, aD as m, aE as A, aF as T, aG as R, aH as V, aI as _, aJ as P, aK as C, aL as k, aM as D, aN as E } from "../generated-CDEDSOGZ.js";
2
- import { encodeAbiParameters as h, zeroHash as L, zeroAddress as O } from "viem";
1
+ import { d as n, ay as y, az as u, aA as w, aB as g, aC as m, aD as p, aE as A, aF as T, aG as R, aH as V, aI as _, aJ as P, aK as C, aL as k, aM as D, aN as E } from "../generated-CDEDSOGZ.js";
2
+ import { encodeAbiParameters as l, zeroHash as L, zeroAddress as O } from "viem";
3
3
  import { E as v } from "../deployments-BdPDIh-i.js";
4
4
  import { DeployableTarget as z } from "../Deployable/DeployableTarget.js";
5
5
  import { prepareClaimPayload as s, StrategyType as t } from "../claiming.js";
@@ -82,7 +82,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
82
82
  * @returns {Promise<Address>}
83
83
  */
84
84
  async asset(f) {
85
- return await p(this._config, {
85
+ return await m(this._config, {
86
86
  address: this.assertValidAddress(),
87
87
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
88
88
  ...f
@@ -97,7 +97,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
97
97
  * @returns {Promise<StrategyType>}
98
98
  */
99
99
  strategy(f) {
100
- return m(this._config, {
100
+ return p(this._config, {
101
101
  address: this.assertValidAddress(),
102
102
  // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally
103
103
  ...f
@@ -172,7 +172,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
172
172
  * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed
173
173
  */
174
174
  async claimRaw(f, b) {
175
- const { request: a, result: d } = await V(
175
+ const { request: a, result: e } = await V(
176
176
  this._config,
177
177
  {
178
178
  address: this.assertValidAddress(),
@@ -182,7 +182,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
182
182
  ...b
183
183
  }
184
184
  );
185
- return { hash: await _(this._config, a), result: d };
185
+ return { hash: await _(this._config, a), result: e };
186
186
  }
187
187
  /**
188
188
  * Clawback assets from the incentive
@@ -206,7 +206,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
206
206
  * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked
207
207
  */
208
208
  async clawbackRaw(f, b) {
209
- const { request: a, result: d } = await P(
209
+ const { request: a, result: e } = await P(
210
210
  this._config,
211
211
  {
212
212
  address: this.assertValidAddress(),
@@ -216,7 +216,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
216
216
  ...b
217
217
  }
218
218
  );
219
- return { hash: await C(this._config, a), result: d };
219
+ return { hash: await C(this._config, a), result: e };
220
220
  }
221
221
  /**
222
222
  * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.
@@ -275,15 +275,41 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
275
275
  * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.
276
276
  */
277
277
  async getTotalBudget(f) {
278
- var e, r, i;
279
- if (((e = this.payload) == null ? void 0 : e.strategy) !== void 0 && ((r = this.payload) == null ? void 0 : r.limit) !== void 0 && ((i = this.payload) == null ? void 0 : i.reward) !== void 0)
278
+ var d, i, r;
279
+ if (((d = this.payload) == null ? void 0 : d.strategy) !== void 0 && ((i = this.payload) == null ? void 0 : i.limit) !== void 0 && ((r = this.payload) == null ? void 0 : r.reward) !== void 0)
280
280
  return this.payload.strategy === t.POOL ? this.payload.limit * this.payload.reward : this.payload.reward;
281
- const [b, a, d] = await Promise.all([
281
+ const [b, a, e] = await Promise.all([
282
282
  this.strategy(f),
283
283
  this.limit(f),
284
284
  this.reward(f)
285
285
  ]);
286
- return b === t.POOL ? a * d : d;
286
+ return b === t.POOL ? a * e : e;
287
+ }
288
+ /**
289
+ * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
290
+ *
291
+ * @public
292
+ * @async
293
+ * @param {?ReadParams} [params]
294
+ * @returns {Promise<boolean>} - True if total claims is less than limit
295
+ */
296
+ async canBeClaimed(f) {
297
+ return await this.getRemainingClaimPotential(f) > 0n;
298
+ }
299
+ /**
300
+ * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.
301
+ *
302
+ * @public
303
+ * @async
304
+ * @param {?ReadParams} [params]
305
+ * @returns {Promise<bigint>} - True if total claims is less than limit
306
+ */
307
+ async getRemainingClaimPotential(f) {
308
+ const [b, a] = await Promise.all([
309
+ this.claims(f),
310
+ this.limit(f)
311
+ ]);
312
+ return a - b;
287
313
  }
288
314
  /**
289
315
  * @inheritdoc
@@ -294,7 +320,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
294
320
  * @returns {GenericDeployableParams}
295
321
  */
296
322
  buildParameters(f, b) {
297
- const [a, d] = this.validateDeploymentConfig(
323
+ const [a, e] = this.validateDeploymentConfig(
298
324
  f,
299
325
  b
300
326
  );
@@ -302,7 +328,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
302
328
  abi: n,
303
329
  bytecode: q,
304
330
  args: [x(a)],
305
- ...this.optionallyAttachAccount(d.account)
331
+ ...this.optionallyAttachAccount(e.account)
306
332
  };
307
333
  }
308
334
  /**
@@ -313,7 +339,7 @@ const q = "0x608060405273deaddeaddeaddeaddeaddeaddeaddeaddeaddead5f806101000a815
313
339
  * @returns {Hex} - Returns an encoded uint256
314
340
  */
315
341
  buildClawbackData(f) {
316
- return h([{ type: "uint256" }], [f]);
342
+ return l([{ type: "uint256" }], [f]);
317
343
  }
318
344
  /**
319
345
  * Builds the claim data for the ERC20Incentive.
@@ -332,13 +358,13 @@ c.bases = {
332
358
  }, c.registryType = F.INCENTIVE;
333
359
  let o = c;
334
360
  function x({
335
- asset: l,
361
+ asset: h,
336
362
  strategy: f,
337
363
  reward: b,
338
364
  limit: a,
339
- manager: d = O
365
+ manager: e = O
340
366
  }) {
341
- return h(
367
+ return l(
342
368
  [
343
369
  { type: "address", name: "asset" },
344
370
  { type: "uint8", name: "strategy" },
@@ -347,12 +373,12 @@ function x({
347
373
  { type: "address", name: "manager" }
348
374
  ],
349
375
  [
350
- l,
376
+ h,
351
377
  f,
352
378
  b,
353
379
  // unclear how user set limit should work for raffle, so in order to avoid passing 0's let's correct it
354
380
  a === 0n && f === t.RAFFLE ? 1n : a,
355
- d
381
+ e
356
382
  ]
357
383
  );
358
384
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ERC20Incentive.js","sources":["../../src/Incentives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n StrategyType,\n prepareClaimPayload,\n} from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\n\n/**\n * The object representation of a `ERC20Incentive.InitPayload`\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive.\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed. This should ideally be 1n for `RAFFLE` strategy types.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can trigger a raffle.\n * If omitted, the incentive will have no manager with permissions to draw the raffle.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20IncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20IncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20IncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<StrategyType>}\n */\n public strategy(params?: ReadParams): Promise<StrategyType> {\n return readErc20IncentiveStrategy(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20IncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async entries(i: bigint, params?: ReadParams) {\n return await readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(params?: WriteParams) {\n return await this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async drawRaffleRaw(params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (\n this.payload?.strategy !== undefined &&\n this.payload?.limit !== undefined &&\n this.payload?.reward !== undefined\n ) {\n return (this.payload.strategy as StrategyType) === StrategyType.POOL\n ? this.payload.limit * this.payload.reward\n : this.payload.reward;\n }\n const [strategy, limit, reward] = await Promise.all([\n this.strategy(params),\n this.limit(params),\n this.reward(params),\n ]);\n return strategy === StrategyType.POOL ? limit * reward : reward;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20Incentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as ERC20Incentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because ERC20Incentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link ERC20IncentivePayload}, properly encode a `ERC20Incentive.InitPayload` for use with {@link ERC20Incentive} initialization.\n *\n * @param {ERC20IncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can draw raffles - defaults to unset\n * @returns {Hex}\n */\nexport function prepareERC20IncentivePayload({\n asset,\n strategy,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20IncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint8', name: 'strategy' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [\n asset,\n strategy,\n reward,\n // unclear how user set limit should work for raffle, so in order to avoid passing 0's let's correct it\n limit === 0n && strategy === StrategyType.RAFFLE ? 1n : limit,\n manager,\n ],\n );\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_a","_b","_c","StrategyType","strategy","limit","reward","_payload","_options","options","bytecode","prepareERC20IncentivePayload","amount","encodeAbiParameters","zeroHash","ERC20IncentiveBases","RegistryType","ERC20Incentive","asset","manager","zeroAddress"],"mappings":";;;;;;o4tBAiHaA,IAAN,MAAMA,UAAuBC,EAGlC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAAwB,KAAK,SAAS;AAAA,MACjD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,cAAcA,GAAqB;AACvC,WAAA,MAAME,EAAgC,KAAK,SAAS;AAAA,MACzD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,OAAOA,GAAqB;AAChC,WAAA,MAAMG,EAAyB,KAAK,SAAS;AAAA,MAClD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIH;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWA,MAAa,QAAQI,GAAkBJ,GAAqB;AACnD,WAAA,MAAMK,EAA0B,KAAK,SAAS;AAAA,MACnD,SAAS,KAAK,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3,"file":"ERC20Incentive.js","sources":["../../src/Incentives/ERC20Incentive.ts"],"sourcesContent":["import {\n erc20IncentiveAbi,\n readErc20IncentiveAsset,\n readErc20IncentiveClaimed,\n readErc20IncentiveClaims,\n readErc20IncentiveCurrentReward,\n readErc20IncentiveEntries,\n readErc20IncentiveIsClaimable,\n readErc20IncentiveLimit,\n readErc20IncentiveOwner,\n readErc20IncentiveReward,\n readErc20IncentiveStrategy,\n simulateErc20IncentiveClaim,\n simulateErc20IncentiveClawback,\n simulateErc20IncentiveDrawRaffle,\n writeErc20IncentiveClaim,\n writeErc20IncentiveClawback,\n writeErc20IncentiveDrawRaffle,\n} from '@boostxyz/evm';\nimport { bytecode } from '@boostxyz/evm/artifacts/contracts/incentives/ERC20Incentive.sol/ERC20Incentive.json';\nimport {\n type Address,\n type ContractEventName,\n type Hex,\n encodeAbiParameters,\n zeroAddress,\n zeroHash,\n} from 'viem';\nimport { ERC20Incentive as ERC20IncentiveBases } from '../../dist/deployments.json';\nimport type {\n DeployableOptions,\n GenericDeployableParams,\n} from '../Deployable/Deployable';\nimport { DeployableTarget } from '../Deployable/DeployableTarget';\nimport {\n type ClaimPayload,\n StrategyType,\n prepareClaimPayload,\n} from '../claiming';\nimport {\n type GenericLog,\n type ReadParams,\n RegistryType,\n type WriteParams,\n} from '../utils';\n\nexport { erc20IncentiveAbi };\n\n/**\n * The object representation of a `ERC20Incentive.InitPayload`\n *\n * @export\n * @interface ERC20IncentivePayload\n * @typedef {ERC20IncentivePayload}\n */\nexport interface ERC20IncentivePayload {\n /**\n * The address of the incentivized asset.\n *\n * @type {Address}\n */\n asset: Address;\n /**\n * The type of disbursement strategy for the incentive.\n *\n * @type {StrategyType}\n */\n strategy: StrategyType;\n /**\n * The amount of the asset to distribute.\n *\n * @type {bigint}\n */\n reward: bigint;\n /**\n * How many times can this incentive be claimed. This should ideally be 1n for `RAFFLE` strategy types.\n *\n * @type {bigint}\n */\n limit: bigint;\n /**\n * (Optional) The address of the entity that can trigger a raffle.\n * If omitted, the incentive will have no manager with permissions to draw the raffle.\n *\n * @type {Address}\n * @optional\n */\n manager?: Address;\n}\n\n/**\n * A generic `viem.Log` event with support for `ERC20Incentive` event types.\n *\n * @export\n * @typedef {ERC20IncentiveLog}\n * @template {ContractEventName<typeof erc20IncentiveAbi>} [event=ContractEventName<\n * typeof erc20IncentiveAbi\n * >]\n */\nexport type ERC20IncentiveLog<\n event extends ContractEventName<typeof erc20IncentiveAbi> = ContractEventName<\n typeof erc20IncentiveAbi\n >,\n> = GenericLog<typeof erc20IncentiveAbi, event>;\n\n/**\n * A simple ERC20 incentive implementation that allows claiming of tokens\n *\n * @export\n * @class ERC20Incentive\n * @typedef {ERC20Incentive}\n * @extends {DeployableTarget<ERC20IncentivePayload>}\n */\nexport class ERC20Incentive extends DeployableTarget<\n ERC20IncentivePayload,\n typeof erc20IncentiveAbi\n> {\n public override readonly abi = erc20IncentiveAbi;\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {Record<number, Address>}\n */\n public static override bases: Record<number, Address> = {\n 31337: import.meta.env.VITE_ERC20_INCENTIVE_BASE,\n ...(ERC20IncentiveBases as Record<number, Address>),\n };\n /**\n * @inheritdoc\n *\n * @public\n * @static\n * @type {RegistryType}\n */\n public static override registryType: RegistryType = RegistryType.INCENTIVE;\n\n /**\n * The owner of the incentive\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async owner(params?: ReadParams) {\n return await readErc20IncentiveOwner(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Calculates the current reward based on the time since the last claim. The reward is calculated based on the time since the last claim, the available budget, and the reward parameters. It increases linearly over time in the absence of claims, with each hour adding `rewardBoost` to the current reward, up to the available budget. For example, if there is one claim in the first hour, then no claims for three hours, the claimable reward would be `initialReward - rewardDecay + (rewardBoost * 3)`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - The current reward\n */\n public async currentReward(params?: ReadParams) {\n return await readErc20IncentiveCurrentReward(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The number of claims that have been made\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async claims(params?: ReadParams) {\n return await readErc20IncentiveClaims(this._config, {\n address: this.assertValidAddress(),\n args: [],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * A mapping of address to claim status\n *\n * @public\n * @async\n * @param {Address} address\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>}\n */\n public async claimed(address: Address, params?: ReadParams) {\n return await readErc20IncentiveClaimed(this._config, {\n address: this.assertValidAddress(),\n args: [address],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The address of the ERC20-like token\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async asset(params?: ReadParams) {\n return await readErc20IncentiveAsset(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The strategy for the incentive (MINT or POOL)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<StrategyType>}\n */\n public strategy(params?: ReadParams): Promise<StrategyType> {\n return readErc20IncentiveStrategy(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n }) as Promise<StrategyType>;\n }\n\n /**\n * The reward amount issued for each claim\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async reward(params?: ReadParams) {\n return await readErc20IncentiveReward(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The limit (max claims, or max entries for raffles)\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>}\n */\n public async limit(params?: ReadParams) {\n return await readErc20IncentiveLimit(this._config, {\n address: this.assertValidAddress(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * The set of addresses that have claimed a slot in the incentive raffle, accessed by bigint index.\n *\n * @public\n * @async\n * @param {bigint} i - Index of address\n * @param {?ReadParams} [params]\n * @returns {Promise<Address>}\n */\n public async entries(i: bigint, params?: ReadParams) {\n return await readErc20IncentiveEntries(this._config, {\n address: this.assertValidAddress(),\n args: [i],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - Returns true if successfully claimed\n */\n protected async claim(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.claimRaw(payload, params));\n }\n\n /**\n * Claim the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - Returns true if successfully claimed\n */\n protected async claimRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClaim(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClaim(this._config, request);\n return { hash, result };\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<boolean>} - True if the assets were successfully clawbacked\n */\n public async clawback(payload: ClaimPayload, params?: WriteParams) {\n return await this.awaitResult(this.clawbackRaw(payload, params));\n }\n\n /**\n * Clawback assets from the incentive\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: boolean; }>} - True if the assets were successfully clawbacked\n */\n public async clawbackRaw(payload: ClaimPayload, params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveClawback(\n this._config,\n {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveClawback(this._config, request);\n return { hash, result };\n }\n\n /**\n * Check if an incentive is claimable. For the POOL strategy, the `bytes data` portion of the payload ignored. The recipient must not have already claimed the incentive.\n *\n * @public\n * @async\n * @param {ClaimPayload} payload\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} = True if the incentive is claimable based on the data payload\n */\n public async isClaimable(payload: ClaimPayload, params?: ReadParams) {\n return await readErc20IncentiveIsClaimable(this._config, {\n address: this.assertValidAddress(),\n args: [prepareClaimPayload(payload)],\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n });\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<void>}\n */\n public async drawRaffle(params?: WriteParams) {\n return await this.awaitResult(this.drawRaffleRaw(params));\n }\n\n /**\n * Draw a winner from the raffle. Only callable by owner. Only valid when the strategy is set to `Strategy.RAFFLE`\n *\n * @public\n * @async\n * @param {?WriteParams} [params]\n * @returns {Promise<{ hash: `0x${string}`; result: void; }>}\n */\n public async drawRaffleRaw(params?: WriteParams) {\n const { request, result } = await simulateErc20IncentiveDrawRaffle(\n this._config,\n {\n address: this.assertValidAddress(),\n ...this.optionallyAttachAccount(),\n // biome-ignore lint/suspicious/noExplicitAny: Accept any shape of valid wagmi/viem parameters, wagmi does the same thing internally\n ...(params as any),\n },\n );\n const hash = await writeErc20IncentiveDrawRaffle(this._config, request);\n return { hash, result };\n }\n\n /**\n * Get the maximum amount that can be claimed by this incentive. Useful when used in conjunction with `BoostCore.calculateProtocolFee`\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} = Return a bigint representing that maximum amount that can be distributed by this incentive.\n */\n public async getTotalBudget(params?: ReadParams) {\n if (\n this.payload?.strategy !== undefined &&\n this.payload?.limit !== undefined &&\n this.payload?.reward !== undefined\n ) {\n return (this.payload.strategy as StrategyType) === StrategyType.POOL\n ? this.payload.limit * this.payload.reward\n : this.payload.reward;\n }\n const [strategy, limit, reward] = await Promise.all([\n this.strategy(params),\n this.limit(params),\n this.reward(params),\n ]);\n return strategy === StrategyType.POOL ? limit * reward : reward;\n }\n\n /**\n * Check if any claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<boolean>} - True if total claims is less than limit\n */\n public async canBeClaimed(params?: ReadParams) {\n return (await this.getRemainingClaimPotential(params)) > 0n;\n }\n\n /**\n * Check how many claims remain by comparing the incentive's total claims against its limit. Does not take requesting user's elligibility into account.\n *\n * @public\n * @async\n * @param {?ReadParams} [params]\n * @returns {Promise<bigint>} - True if total claims is less than limit\n */\n public async getRemainingClaimPotential(params?: ReadParams) {\n const [claims, limit] = await Promise.all([\n this.claims(params),\n this.limit(params),\n ]);\n return limit - claims;\n }\n\n /**\n * @inheritdoc\n *\n * @public\n * @param {?ERC20IncentivePayload} [_payload]\n * @param {?DeployableOptions} [_options]\n * @returns {GenericDeployableParams}\n */\n public override buildParameters(\n _payload?: ERC20IncentivePayload,\n _options?: DeployableOptions,\n ): GenericDeployableParams {\n const [payload, options] = this.validateDeploymentConfig(\n _payload,\n _options,\n );\n return {\n abi: erc20IncentiveAbi,\n bytecode: bytecode as Hex,\n args: [prepareERC20IncentivePayload(payload)],\n ...this.optionallyAttachAccount(options.account),\n };\n }\n\n /**\n * Encodes an amount to clawback from the incentive\n *\n * @public\n * @param {bigint} amount - How much of the asset to clawback\n * @returns {Hex} - Returns an encoded uint256\n */\n public buildClawbackData(amount: bigint) {\n return encodeAbiParameters([{ type: 'uint256' }], [amount]);\n }\n\n /**\n * Builds the claim data for the ERC20Incentive.\n *\n * @public\n * @returns {Hash} A `zeroHash`, as ERC20Incentive doesn't require specific claim data.\n * @description This function returns `zeroHash` because ERC20Incentive doesn't use any specific claim data.\n */\n public buildClaimData() {\n return zeroHash;\n }\n}\n\n/**\n * Given a {@link ERC20IncentivePayload}, properly encode a `ERC20Incentive.InitPayload` for use with {@link ERC20Incentive} initialization.\n *\n * @param {ERC20IncentivePayload} param0\n * @param {Address} param0.asset - The address of the incentivized asset.\n * @param {StrategyType} param0.strategy - The type of disbursement strategy for the incentive. `StrategyType.MINT` is not supported for `ERC20Incentives`\n * @param {bigint} param0.reward - The amount of the asset to distribute.\n * @param {bigint} param0.limit - How many times can this incentive be claimed.\n * @param {Address} [param0.manager=zeroAddress] - The entity that can draw raffles - defaults to unset\n * @returns {Hex}\n */\nexport function prepareERC20IncentivePayload({\n asset,\n strategy,\n reward,\n limit,\n manager = zeroAddress,\n}: ERC20IncentivePayload) {\n return encodeAbiParameters(\n [\n { type: 'address', name: 'asset' },\n { type: 'uint8', name: 'strategy' },\n { type: 'uint256', name: 'reward' },\n { type: 'uint256', name: 'limit' },\n { type: 'address', name: 'manager' },\n ],\n [\n asset,\n strategy,\n reward,\n // unclear how user set limit should work for raffle, so in order to avoid passing 0's let's correct it\n limit === 0n && strategy === StrategyType.RAFFLE ? 1n : limit,\n manager,\n ],\n );\n}\n"],"names":["_ERC20Incentive","DeployableTarget","erc20IncentiveAbi","params","readErc20IncentiveOwner","readErc20IncentiveCurrentReward","readErc20IncentiveClaims","address","readErc20IncentiveClaimed","readErc20IncentiveAsset","readErc20IncentiveStrategy","readErc20IncentiveReward","readErc20IncentiveLimit","i","readErc20IncentiveEntries","payload","request","result","simulateErc20IncentiveClaim","prepareClaimPayload","writeErc20IncentiveClaim","simulateErc20IncentiveClawback","writeErc20IncentiveClawback","readErc20IncentiveIsClaimable","simulateErc20IncentiveDrawRaffle","writeErc20IncentiveDrawRaffle","_a","_b","_c","StrategyType","strategy","limit","reward","claims","_payload","_options","options","bytecode","prepareERC20IncentivePayload","amount","encodeAbiParameters","zeroHash","ERC20IncentiveBases","RegistryType","ERC20Incentive","asset","manager","zeroAddress"],"mappings":";;;;;;o4tBAiHaA,IAAN,MAAMA,UAAuBC,EAGlC;AAAA,EAHK,cAAA;AAAA,UAAA,GAAA,SAAA,GAIL,KAAyB,MAAMC;AAAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EA6B/B,MAAa,MAAMC,GAAqB;AAC/B,WAAA,MAAMC,EAAwB,KAAK,SAAS;AAAA,MACjD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAID;AAAA,IAAA,CACL;AAAA,EACH;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,MAAa,cAAcA,GAAqB;AACvC,WAAA,MAAME,EAAgC,KAAK,SAAS;AAAA,MACzD,SAAS,KAAK,mBAAmB;AAAA,MACjC,MAAM,CAAC;AAAA;AAAA,MAEP,GAAIF;AAAA,IAAA,CACL;AAAA,EACH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