@raac/rpc 1.2.0-beta.10 → 1.2.0-beta.12

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 (243) hide show
  1. package/dist/RPCLibrary.js +2 -0
  2. package/dist/artifacts/core/governance/gauges/BaseGauge.sol/BaseGauge.json +113 -20
  3. package/dist/artifacts/core/governance/gauges/GaugeController.sol/GaugeController.json +259 -31
  4. package/dist/artifacts/core/governance/gauges/GaugeRewardsDistributor.sol/GaugeRewardsDistributor.json +159 -31
  5. package/dist/artifacts/core/governance/gauges/RAACGauge.sol/RAACGauge.json +115 -22
  6. package/dist/artifacts/core/governance/gauges/RWAGauge.sol/RWAGauge.json +115 -22
  7. package/dist/configs/chains/1.json +22 -25
  8. package/dist/configs/chains/11155111.json +76 -112
  9. package/dist/configs/chains/17000.json +22 -25
  10. package/dist/configs/chains/18453.json +22 -25
  11. package/dist/configs/chains/8453.json +61 -31
  12. package/dist/contracts/findContract.js +11 -4
  13. package/dist/contracts/getContractAddress.js +0 -1
  14. package/dist/contracts/governance/distributor/claimAll.js +18 -11
  15. package/dist/contracts/governance/distributor/claimForGauge.js +18 -12
  16. package/dist/contracts/governance/distributor/deposit.js +17 -12
  17. package/dist/contracts/governance/distributor/getClaimableForGauge.js +10 -9
  18. package/dist/contracts/governance/distributor/getClaimedAtEpoch.js +11 -10
  19. package/dist/contracts/governance/distributor/getDepositedAtEpoch.js +8 -8
  20. package/dist/contracts/governance/distributor/getDustLastProcessedEpoch.js +28 -0
  21. package/dist/contracts/governance/distributor/getGaugeController.js +7 -7
  22. package/dist/contracts/governance/distributor/getLastClaimedEpoch.js +10 -9
  23. package/dist/contracts/governance/distributor/getMaxClaimBound.js +29 -0
  24. package/dist/contracts/governance/distributor/getPeriodDuration.js +7 -7
  25. package/dist/contracts/governance/distributor/getRewardToken.js +7 -7
  26. package/dist/contracts/governance/distributor/getRewardTokenInfo.js +7 -7
  27. package/dist/contracts/governance/distributor/getRewardTokenStats.js +7 -7
  28. package/dist/contracts/governance/distributor/index.js +5 -2
  29. package/dist/contracts/governance/distributor/setController.js +17 -12
  30. package/dist/contracts/governance/distributor/setLastClaimedEpoch.js +32 -0
  31. package/dist/contracts/governance/distributor/setMaxClaimBound.js +31 -0
  32. package/dist/contracts/governance/distributor/withdrawDust.js +31 -0
  33. package/dist/contracts/governance/distributor/withdrawRemovedGaugeRewards.js +19 -13
  34. package/dist/contracts/governance/gauge/_apy.js +122 -0
  35. package/dist/contracts/governance/gauge/_tokens.js +36 -0
  36. package/dist/contracts/governance/gauge/addRewardToken.js +2 -12
  37. package/dist/contracts/governance/gauge/approveGaugeToken.js +31 -0
  38. package/dist/contracts/governance/gauge/claimExtraReward.js +2 -12
  39. package/dist/contracts/governance/gauge/claimExtraRewards.js +2 -12
  40. package/dist/contracts/governance/gauge/claimOnBehalfOf.js +2 -12
  41. package/dist/contracts/governance/gauge/claimRewardToken.js +3 -13
  42. package/dist/contracts/governance/gauge/claimRewardsFor.js +2 -12
  43. package/dist/contracts/governance/gauge/depositRewardToken.js +2 -12
  44. package/dist/contracts/governance/gauge/getAllPendingExtraRewards.js +2 -9
  45. package/dist/contracts/governance/gauge/getApy.js +44 -0
  46. package/dist/contracts/governance/gauge/getBalanceOf.js +2 -15
  47. package/dist/contracts/governance/gauge/getControllerAddress.js +2 -9
  48. package/dist/contracts/governance/gauge/getDecimalAdjustment.js +2 -9
  49. package/dist/contracts/governance/gauge/getDepositRAACOnClaim.js +2 -9
  50. package/dist/contracts/governance/gauge/getDistributorData.js +2 -9
  51. package/dist/contracts/governance/gauge/getDistributors.js +2 -9
  52. package/dist/contracts/governance/gauge/getEarnedExtraReward.js +30 -0
  53. package/dist/contracts/governance/gauge/getEarnedReward.js +8 -14
  54. package/dist/contracts/governance/gauge/getExtraRewardTokens.js +2 -9
  55. package/dist/contracts/governance/gauge/getGaugeData.js +39 -0
  56. package/dist/contracts/governance/gauge/getGaugeRewardTokenData.js +2 -9
  57. package/dist/contracts/governance/gauge/getPauseStatus.js +31 -0
  58. package/dist/contracts/governance/gauge/getPendingExtraRewards.js +2 -9
  59. package/dist/contracts/governance/gauge/getPendingRewards.js +8 -14
  60. package/dist/contracts/governance/gauge/getPeriodBoundaries.js +2 -15
  61. package/dist/contracts/governance/gauge/getPeriodDuration.js +2 -15
  62. package/dist/contracts/governance/gauge/getRaacAutolockMin.js +2 -9
  63. package/dist/contracts/governance/gauge/getRawBalanceOf.js +2 -15
  64. package/dist/contracts/governance/gauge/getRawTotalSupply.js +2 -15
  65. package/dist/contracts/governance/gauge/getRewardTokens.js +28 -0
  66. package/dist/contracts/governance/gauge/getTotalSupply.js +2 -15
  67. package/dist/contracts/governance/gauge/getUserApy.js +71 -0
  68. package/dist/contracts/governance/gauge/getUserClaimableRewards.js +21 -73
  69. package/dist/contracts/governance/gauge/getUserGaugeState.js +44 -0
  70. package/dist/contracts/governance/gauge/getUserRewardTokenData.js +2 -9
  71. package/dist/contracts/governance/gauge/getUserWeight.js +2 -9
  72. package/dist/contracts/governance/gauge/index.js +11 -1
  73. package/dist/contracts/governance/gauge/isPaused.js +4 -11
  74. package/dist/contracts/governance/gauge/manageDistributor.js +2 -12
  75. package/dist/contracts/governance/gauge/pullRewardsFromDistributor.js +30 -0
  76. package/dist/contracts/governance/gauge/setController.js +2 -12
  77. package/dist/contracts/governance/gauge/setDepositRAACOnClaim.js +2 -12
  78. package/dist/contracts/governance/gauge/setEmergencyPaused.js +2 -12
  79. package/dist/contracts/governance/gauge/setGaugeRewardDistributor.js +2 -12
  80. package/dist/contracts/governance/gauge/setRaacAutolockMin.js +2 -12
  81. package/dist/contracts/governance/gauge/stake.js +2 -18
  82. package/dist/contracts/governance/gauge/unwrapStakingToken.js +28 -0
  83. package/dist/contracts/governance/gauge/updateUserRewards.js +2 -18
  84. package/dist/contracts/governance/gauge/withdraw.js +2 -18
  85. package/dist/contracts/governance/gauge/wrapStakingToken.js +28 -0
  86. package/dist/contracts/governance/gaugeController/addGauge.js +19 -11
  87. package/dist/contracts/governance/gaugeController/batchVote.js +20 -12
  88. package/dist/contracts/governance/gaugeController/calculateBoost.js +20 -23
  89. package/dist/contracts/governance/gaugeController/forceCompleteCheckpoint.js +19 -11
  90. package/dist/contracts/governance/gaugeController/getActiveGaugeCount.js +28 -0
  91. package/dist/contracts/governance/gaugeController/getActiveGauges.js +10 -13
  92. package/dist/contracts/governance/gaugeController/getConstants.js +10 -18
  93. package/dist/contracts/governance/gaugeController/getCurrentEpoch.js +8 -7
  94. package/dist/contracts/governance/gaugeController/getExpiredGaugeVotePower.js +30 -0
  95. package/dist/contracts/governance/gaugeController/getGauge.js +11 -9
  96. package/dist/contracts/governance/gaugeController/getGaugeDistributor.js +28 -0
  97. package/dist/contracts/governance/gaugeController/getGaugeEmissions.js +15 -9
  98. package/dist/contracts/governance/gaugeController/getGaugeRelativeWeight.js +19 -15
  99. package/dist/contracts/governance/gaugeController/getGaugeRelativeWeightView.js +12 -10
  100. package/dist/contracts/governance/gaugeController/getGaugeWeight.js +10 -8
  101. package/dist/contracts/governance/gaugeController/getLastVoteTime.js +11 -9
  102. package/dist/contracts/governance/gaugeController/getMaxVoteBuckets.js +28 -0
  103. package/dist/contracts/governance/gaugeController/getNextEpoch.js +8 -7
  104. package/dist/contracts/governance/gaugeController/getRegisteredGaugeList.js +28 -0
  105. package/dist/contracts/governance/gaugeController/getTotalWeight.js +8 -7
  106. package/dist/contracts/governance/gaugeController/getUserGaugeVotePower.js +11 -9
  107. package/dist/contracts/governance/gaugeController/getUserVotePowerRemaining.js +10 -9
  108. package/dist/contracts/governance/gaugeController/getVeToken.js +8 -7
  109. package/dist/contracts/governance/gaugeController/getVoteUserLocks.js +32 -0
  110. package/dist/contracts/governance/gaugeController/getVoteUserPower.js +8 -7
  111. package/dist/contracts/governance/gaugeController/getVoteUserSlope.js +12 -10
  112. package/dist/contracts/governance/gaugeController/index.js +10 -1
  113. package/dist/contracts/governance/gaugeController/isGaugeActive.js +11 -9
  114. package/dist/contracts/governance/gaugeController/isPaused.js +9 -8
  115. package/dist/contracts/governance/gaugeController/kick.js +17 -10
  116. package/dist/contracts/governance/gaugeController/removeGauge.js +20 -11
  117. package/dist/contracts/governance/gaugeController/removePowerFromGauge.js +19 -11
  118. package/dist/contracts/governance/gaugeController/setBoostAmplificationEnabled.js +20 -12
  119. package/dist/contracts/governance/gaugeController/setDistributor.js +31 -0
  120. package/dist/contracts/governance/gaugeController/setEmergencyGaugePause.js +20 -12
  121. package/dist/contracts/governance/gaugeController/setEmergencyGaugePauseBatch.js +33 -0
  122. package/dist/contracts/governance/gaugeController/setEmergencyPause.js +18 -11
  123. package/dist/contracts/governance/gaugeController/setMaxVoteBuckets.js +31 -0
  124. package/dist/contracts/governance/gaugeController/vote.js +15 -16
  125. package/dist/contracts/governance/gaugeSystems/_helpers.js +123 -0
  126. package/dist/contracts/governance/gaugeSystems/findGauge.js +14 -0
  127. package/dist/contracts/governance/gaugeSystems/getGaugeSystem.js +14 -0
  128. package/dist/contracts/governance/gaugeSystems/getGaugeSystems.js +13 -0
  129. package/dist/contracts/governance/gaugeSystems/getGauges.js +15 -0
  130. package/dist/contracts/governance/gaugeSystems/index.js +21 -0
  131. package/dist/types/RPCLibrary.d.ts +2 -0
  132. package/dist/types/configs/chains/index.d.ts +36 -46
  133. package/dist/types/configs/index.d.ts +18 -23
  134. package/dist/types/contracts/governance/distributor/claimAll.d.ts +7 -5
  135. package/dist/types/contracts/governance/distributor/claimForGauge.d.ts +7 -6
  136. package/dist/types/contracts/governance/distributor/deposit.d.ts +7 -6
  137. package/dist/types/contracts/governance/distributor/getClaimableForGauge.d.ts +6 -4
  138. package/dist/types/contracts/governance/distributor/getClaimedAtEpoch.d.ts +7 -5
  139. package/dist/types/contracts/governance/distributor/getDepositedAtEpoch.d.ts +6 -4
  140. package/dist/types/contracts/governance/distributor/getDustLastProcessedEpoch.d.ts +12 -0
  141. package/dist/types/contracts/governance/distributor/getGaugeController.d.ts +5 -3
  142. package/dist/types/contracts/governance/distributor/getLastClaimedEpoch.d.ts +6 -4
  143. package/dist/types/contracts/governance/distributor/getMaxClaimBound.d.ts +15 -0
  144. package/dist/types/contracts/governance/distributor/getPeriodDuration.d.ts +5 -3
  145. package/dist/types/contracts/governance/distributor/getRewardToken.d.ts +5 -3
  146. package/dist/types/contracts/governance/distributor/getRewardTokenInfo.d.ts +5 -3
  147. package/dist/types/contracts/governance/distributor/getRewardTokenStats.d.ts +5 -3
  148. package/dist/types/contracts/governance/distributor/index.d.ts +5 -2
  149. package/dist/types/contracts/governance/distributor/setController.d.ts +7 -6
  150. package/dist/types/contracts/governance/distributor/setLastClaimedEpoch.d.ts +13 -0
  151. package/dist/types/contracts/governance/distributor/setMaxClaimBound.d.ts +13 -0
  152. package/dist/types/contracts/governance/distributor/withdrawDust.d.ts +13 -0
  153. package/dist/types/contracts/governance/distributor/withdrawRemovedGaugeRewards.d.ts +8 -7
  154. package/dist/types/contracts/governance/gauge/_apy.d.ts +61 -0
  155. package/dist/types/contracts/governance/gauge/_tokens.d.ts +14 -0
  156. package/dist/types/contracts/governance/gauge/approveGaugeToken.d.ts +14 -0
  157. package/dist/types/contracts/governance/gauge/claimRewardToken.d.ts +1 -1
  158. package/dist/types/contracts/governance/gauge/getApy.d.ts +41 -0
  159. package/dist/types/contracts/governance/gauge/getEarnedExtraReward.d.ts +13 -0
  160. package/dist/types/contracts/governance/gauge/getEarnedReward.d.ts +3 -2
  161. package/dist/types/contracts/governance/gauge/getGaugeData.d.ts +23 -0
  162. package/dist/types/contracts/governance/gauge/getPauseStatus.d.ts +19 -0
  163. package/dist/types/contracts/governance/gauge/getPendingRewards.d.ts +3 -2
  164. package/dist/types/contracts/governance/gauge/getRewardTokens.d.ts +11 -0
  165. package/dist/types/contracts/governance/gauge/getUserApy.d.ts +44 -0
  166. package/dist/types/contracts/governance/gauge/getUserClaimableRewards.d.ts +14 -12
  167. package/dist/types/contracts/governance/gauge/getUserGaugeState.d.ts +31 -0
  168. package/dist/types/contracts/governance/gauge/index.d.ts +11 -1
  169. package/dist/types/contracts/governance/gauge/isPaused.d.ts +1 -1
  170. package/dist/types/contracts/governance/gauge/pullRewardsFromDistributor.d.ts +11 -0
  171. package/dist/types/contracts/governance/gauge/unwrapStakingToken.d.ts +12 -0
  172. package/dist/types/contracts/governance/gauge/wrapStakingToken.d.ts +13 -0
  173. package/dist/types/contracts/governance/gaugeController/addGauge.d.ts +8 -5
  174. package/dist/types/contracts/governance/gaugeController/batchVote.d.ts +9 -6
  175. package/dist/types/contracts/governance/gaugeController/calculateBoost.d.ts +10 -8
  176. package/dist/types/contracts/governance/gaugeController/forceCompleteCheckpoint.d.ts +8 -5
  177. package/dist/types/contracts/governance/gaugeController/getActiveGaugeCount.d.ts +12 -0
  178. package/dist/types/contracts/governance/gaugeController/getActiveGauges.d.ts +7 -3
  179. package/dist/types/contracts/governance/gaugeController/getConstants.d.ts +6 -4
  180. package/dist/types/contracts/governance/gaugeController/getCurrentEpoch.d.ts +6 -3
  181. package/dist/types/contracts/governance/gaugeController/getExpiredGaugeVotePower.d.ts +16 -0
  182. package/dist/types/contracts/governance/gaugeController/getGauge.d.ts +7 -4
  183. package/dist/types/contracts/governance/gaugeController/getGaugeDistributor.d.ts +12 -0
  184. package/dist/types/contracts/governance/gaugeController/getGaugeEmissions.d.ts +6 -3
  185. package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeight.d.ts +8 -9
  186. package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeightView.d.ts +8 -5
  187. package/dist/types/contracts/governance/gaugeController/getGaugeWeight.d.ts +6 -4
  188. package/dist/types/contracts/governance/gaugeController/getLastVoteTime.d.ts +7 -4
  189. package/dist/types/contracts/governance/gaugeController/getMaxVoteBuckets.d.ts +12 -0
  190. package/dist/types/contracts/governance/gaugeController/getNextEpoch.d.ts +6 -3
  191. package/dist/types/contracts/governance/gaugeController/getRegisteredGaugeList.d.ts +12 -0
  192. package/dist/types/contracts/governance/gaugeController/getTotalWeight.d.ts +5 -3
  193. package/dist/types/contracts/governance/gaugeController/getUserGaugeVotePower.d.ts +7 -4
  194. package/dist/types/contracts/governance/gaugeController/getUserVotePowerRemaining.d.ts +6 -4
  195. package/dist/types/contracts/governance/gaugeController/getVeToken.d.ts +6 -3
  196. package/dist/types/contracts/governance/gaugeController/getVoteUserLocks.d.ts +17 -0
  197. package/dist/types/contracts/governance/gaugeController/getVoteUserPower.d.ts +6 -3
  198. package/dist/types/contracts/governance/gaugeController/getVoteUserSlope.d.ts +8 -5
  199. package/dist/types/contracts/governance/gaugeController/index.d.ts +10 -1
  200. package/dist/types/contracts/governance/gaugeController/isGaugeActive.d.ts +6 -4
  201. package/dist/types/contracts/governance/gaugeController/isPaused.d.ts +6 -3
  202. package/dist/types/contracts/governance/gaugeController/kick.d.ts +7 -4
  203. package/dist/types/contracts/governance/gaugeController/removeGauge.d.ts +9 -5
  204. package/dist/types/contracts/governance/gaugeController/removePowerFromGauge.d.ts +8 -5
  205. package/dist/types/contracts/governance/gaugeController/setBoostAmplificationEnabled.d.ts +9 -6
  206. package/dist/types/contracts/governance/gaugeController/setDistributor.d.ts +13 -0
  207. package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePause.d.ts +9 -6
  208. package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePauseBatch.d.ts +14 -0
  209. package/dist/types/contracts/governance/gaugeController/setEmergencyPause.d.ts +8 -5
  210. package/dist/types/contracts/governance/gaugeController/setMaxVoteBuckets.d.ts +13 -0
  211. package/dist/types/contracts/governance/gaugeController/vote.d.ts +9 -7
  212. package/dist/types/contracts/governance/gaugeSystems/_helpers.d.ts +71 -0
  213. package/dist/types/contracts/governance/gaugeSystems/findGauge.d.ts +11 -0
  214. package/dist/types/contracts/governance/gaugeSystems/getGaugeSystem.d.ts +11 -0
  215. package/dist/types/contracts/governance/gaugeSystems/getGaugeSystems.d.ts +10 -0
  216. package/dist/types/contracts/governance/gaugeSystems/getGauges.d.ts +13 -0
  217. package/dist/types/contracts/governance/gaugeSystems/index.d.ts +5 -0
  218. package/dist/types/typechain-types/contracts/core/governance/gauges/BaseGauge.d.ts +176 -105
  219. package/dist/types/typechain-types/contracts/core/governance/gauges/GaugeController.d.ts +260 -213
  220. package/dist/types/typechain-types/contracts/core/governance/gauges/GaugeRewardsDistributor.d.ts +173 -212
  221. package/dist/types/typechain-types/contracts/core/governance/gauges/RAACGauge.d.ts +176 -105
  222. package/dist/types/typechain-types/contracts/core/governance/gauges/RWAGauge.d.ts +176 -105
  223. package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IBaseGauge.d.ts +111 -108
  224. package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IGaugeController.d.ts +210 -34
  225. package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IGaugeRewardsDistributor.d.ts +112 -151
  226. package/dist/types/typechain-types/factories/contracts/core/governance/gauges/BaseGauge__factory.d.ts +174 -95
  227. package/dist/types/typechain-types/factories/contracts/core/governance/gauges/GaugeController__factory.d.ts +243 -227
  228. package/dist/types/typechain-types/factories/contracts/core/governance/gauges/GaugeRewardsDistributor__factory.d.ts +164 -232
  229. package/dist/types/typechain-types/factories/contracts/core/governance/gauges/RAACGauge__factory.d.ts +185 -98
  230. package/dist/types/typechain-types/factories/contracts/core/governance/gauges/RWAGauge__factory.d.ts +185 -98
  231. package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IBaseGauge__factory.d.ts +104 -95
  232. package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IGaugeController__factory.d.ts +241 -22
  233. package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IGaugeRewardsDistributor__factory.d.ts +72 -158
  234. package/dist/types/utils/artifacts.d.ts +40 -0
  235. package/dist/types/utils/contracts.d.ts +34 -44
  236. package/dist/utils/contracts.js +1 -1
  237. package/package.json +1 -1
  238. package/dist/contracts/governance/distributor/getStartEpoch.js +0 -28
  239. package/dist/contracts/governance/distributor/withdrawUnallocatedRewards.js +0 -26
  240. package/dist/contracts/governance/gauge/setDistributorApproval.js +0 -35
  241. package/dist/types/contracts/governance/distributor/getStartEpoch.d.ts +0 -10
  242. package/dist/types/contracts/governance/distributor/withdrawUnallocatedRewards.d.ts +0 -12
  243. package/dist/types/contracts/governance/gauge/setDistributorApproval.d.ts +0 -11
@@ -28,7 +28,6 @@ const getContractAddress = (chainId, contractName) => {
28
28
  "nfts",
29
29
  "lockers",
30
30
  "zap",
31
- "gauges",
32
31
  ];
33
32
  let address = null;
34
33
  for (const key of lookupKeys) {
@@ -2,24 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.claimAll = void 0;
4
4
  const ethers_1 = require("ethers");
5
- const getContractAddress_1 = require("../../getContractAddress");
6
5
  const artifacts_1 = require("../../../utils/artifacts");
6
+ const _helpers_1 = require("../gaugeSystems/_helpers");
7
+ const _helpers_2 = require("../_helpers");
7
8
  /**
8
- * Claims accrued rewards for multiple gauges in a single transaction.
9
+ * Claims rewards for the caller on several gauges. Each gauge must be active.
9
10
  *
10
11
  * @param chainId - The chain/network to use.
11
- * @param gauges - Array of gauge addresses.
12
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
13
+ * @param gaugeAddressesOrIds - Addresses or config ids of the gauges.
12
14
  * @param signer - An ethers.js Signer instance (required).
13
- * @returns Transaction after it has been mined.
15
+ * @returns The transaction after it has been mined.
14
16
  */
15
- const claimAll = async (chainId, gauges, signer) => {
17
+ const claimAll = async (chainId, gaugeSystem, gaugeAddressesOrIds, signer) => {
16
18
  if (!signer)
17
19
  throw new Error("Signer is required");
18
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
19
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
20
- const contract = new ethers_1.ethers.Contract(address, abi, signer);
21
- const tx = await contract.claimAll(gauges);
22
- await tx.wait();
23
- return tx;
20
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
21
+ const gaugeAddresses = gaugeAddressesOrIds.map((g) => (0, _helpers_1.resolveGauge)(chainId, g));
22
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), signer);
23
+ try {
24
+ const tx = await contract.claimAll(gaugeAddresses);
25
+ await tx.wait();
26
+ return tx;
27
+ }
28
+ catch (error) {
29
+ throw (0, _helpers_2.toGovernanceTxError)("Failed to claim all", error);
30
+ }
24
31
  };
25
32
  exports.claimAll = claimAll;
@@ -2,25 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.claimForGauge = void 0;
4
4
  const ethers_1 = require("ethers");
5
- const getContractAddress_1 = require("../../getContractAddress");
6
5
  const artifacts_1 = require("../../../utils/artifacts");
6
+ const _helpers_1 = require("../gaugeSystems/_helpers");
7
+ const _helpers_2 = require("../_helpers");
7
8
  /**
8
- * Claims accrued rewards for a gauge.
9
- * Note: only callable by the gauge contract itself (msg.sender must == gauge).
9
+ * Transfers a gauge's accrued share from the distributor to the gauge.
10
10
  *
11
11
  * @param chainId - The chain/network to use.
12
- * @param gauge - Address of the gauge.
12
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
13
+ * @param gaugeAddressOrId - Address or config id of the gauge.
13
14
  * @param signer - An ethers.js Signer instance (required).
14
- * @returns Transaction after it has been mined.
15
+ * @returns The transaction after it has been mined.
15
16
  */
16
- const claimForGauge = async (chainId, gauge, signer) => {
17
+ const claimForGauge = async (chainId, gaugeSystem, gaugeAddressOrId, signer) => {
17
18
  if (!signer)
18
19
  throw new Error("Signer is required");
19
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
20
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
21
- const contract = new ethers_1.ethers.Contract(address, abi, signer);
22
- const tx = await contract.claimForGauge(gauge);
23
- await tx.wait();
24
- return tx;
20
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
21
+ const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
22
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), signer);
23
+ try {
24
+ const tx = await contract.claimForGauge(gaugeAddress);
25
+ await tx.wait();
26
+ return tx;
27
+ }
28
+ catch (error) {
29
+ throw (0, _helpers_2.toGovernanceTxError)("Failed to claim for gauge", error);
30
+ }
25
31
  };
26
32
  exports.claimForGauge = claimForGauge;
@@ -2,26 +2,31 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.deposit = void 0;
4
4
  const ethers_1 = require("ethers");
5
- const getContractAddress_1 = require("../../getContractAddress");
6
5
  const artifacts_1 = require("../../../utils/artifacts");
6
+ const _helpers_1 = require("../gaugeSystems/_helpers");
7
+ const _helpers_2 = require("../_helpers");
7
8
  /**
8
- * Deposits reward tokens into the distributor.
9
- * The reward token must be pre-approved by the caller before calling.
9
+ * Deposits reward tokens into the distributor for the current epoch. The token must be the distributor's reward token and pre-approved. Reverts when no gauge is registered.
10
10
  *
11
11
  * @param chainId - The chain/network to use.
12
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
12
13
  * @param token - Address of the reward token.
13
- * @param amount - Amount of reward tokens to deposit.
14
+ * @param amount - Amount to deposit, base units.
14
15
  * @param signer - An ethers.js Signer instance (required).
15
- * @returns Transaction after it has been mined.
16
+ * @returns The transaction after it has been mined.
16
17
  */
17
- const deposit = async (chainId, token, amount, signer) => {
18
+ const deposit = async (chainId, gaugeSystem, token, amount, signer) => {
18
19
  if (!signer)
19
20
  throw new Error("Signer is required");
20
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
21
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
22
- const contract = new ethers_1.ethers.Contract(address, abi, signer);
23
- const tx = await contract.deposit(token, amount);
24
- await tx.wait();
25
- return tx;
21
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
22
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), signer);
23
+ try {
24
+ const tx = await contract.deposit(token, amount);
25
+ await tx.wait();
26
+ return tx;
27
+ }
28
+ catch (error) {
29
+ throw (0, _helpers_2.toGovernanceTxError)("Failed to deposit rewards", error);
30
+ }
26
31
  };
27
32
  exports.deposit = deposit;
@@ -6,24 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getClaimableForGauge = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the amount of rewards currently claimable for a gauge.
12
+ * Estimates the rewards a gauge can still pull from the distributor.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
- * @param gauge - Address of the gauge.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
16
+ * @param gaugeAddressOrId - Address or config id of the gauge.
16
17
  * @param provider - Optional ethers.js Provider instance.
17
- * @returns Claimable reward amount (bigint).
18
+ * @returns The claimable amount, base units.
18
19
  */
19
- const getClaimableForGauge = async (chainId, gauge, provider) => {
20
+ const getClaimableForGauge = async (chainId, gaugeSystem, gaugeAddressOrId, provider) => {
20
21
  if (!provider) {
21
22
  const rpc = chains_1.default[chainId].rpcs[0];
22
23
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
24
  }
24
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
25
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
26
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
27
- return contract.getClaimableForGauge(gauge);
25
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
26
+ const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
27
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
28
+ return contract.getClaimableForGauge(gaugeAddress);
28
29
  };
29
30
  exports.getClaimableForGauge = getClaimableForGauge;
@@ -6,25 +6,26 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getClaimedAtEpoch = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the amount claimed by a gauge at a specific epoch.
12
+ * Returns how much a gauge has already pulled for an epoch.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
- * @param gauge - Address of the gauge.
16
- * @param epoch - The epoch to query.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
16
+ * @param gaugeAddressOrId - Address or config id of the gauge.
17
+ * @param epoch - Epoch start timestamp, seconds.
17
18
  * @param provider - Optional ethers.js Provider instance.
18
- * @returns Amount claimed at the epoch (bigint).
19
+ * @returns The claimed amount, base units.
19
20
  */
20
- const getClaimedAtEpoch = async (chainId, gauge, epoch, provider) => {
21
+ const getClaimedAtEpoch = async (chainId, gaugeSystem, gaugeAddressOrId, epoch, provider) => {
21
22
  if (!provider) {
22
23
  const rpc = chains_1.default[chainId].rpcs[0];
23
24
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
24
25
  }
25
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
26
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
27
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
28
- return contract.claimedAtEpoch(gauge, epoch);
26
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
27
+ const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
28
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
29
+ return contract.claimedAtEpoch(gaugeAddress, epoch);
29
30
  };
30
31
  exports.getClaimedAtEpoch = getClaimedAtEpoch;
@@ -6,25 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDepositedAtEpoch = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the amount of a token deposited at a specific epoch.
12
+ * Returns the rewards deposited into the distributor for an epoch.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param token - Address of the reward token.
16
- * @param epoch - The epoch to query.
17
+ * @param epoch - Epoch start timestamp, seconds.
17
18
  * @param provider - Optional ethers.js Provider instance.
18
- * @returns Amount deposited at the epoch (bigint).
19
+ * @returns The deposited amount, base units.
19
20
  */
20
- const getDepositedAtEpoch = async (chainId, token, epoch, provider) => {
21
+ const getDepositedAtEpoch = async (chainId, gaugeSystem, token, epoch, provider) => {
21
22
  if (!provider) {
22
23
  const rpc = chains_1.default[chainId].rpcs[0];
23
24
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
24
25
  }
25
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
26
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
27
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
26
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
27
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
28
28
  return contract.depositedAtEpoch(token, epoch);
29
29
  };
30
30
  exports.getDepositedAtEpoch = getDepositedAtEpoch;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getDustLastProcessedEpoch = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const chains_1 = __importDefault(require("../../../configs/chains"));
9
+ const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
+ /**
12
+ * Returns the cursor of the last epoch swept by `withdrawDust`.
13
+ *
14
+ * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
16
+ * @param provider - Optional ethers.js Provider instance.
17
+ * @returns The epoch timestamp, seconds.
18
+ */
19
+ const getDustLastProcessedEpoch = async (chainId, gaugeSystem, provider) => {
20
+ if (!provider) {
21
+ const rpc = chains_1.default[chainId].rpcs[0];
22
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
+ }
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
+ return contract.dustLastProcessedEpoch();
27
+ };
28
+ exports.getDustLastProcessedEpoch = getDustLastProcessedEpoch;
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getGaugeController = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the gauge controller address used by the distributor.
12
+ * Returns the GaugeController the distributor reads weights from.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param provider - Optional ethers.js Provider instance.
16
- * @returns Gauge controller address (string).
17
+ * @returns The controller address.
17
18
  */
18
- const getGaugeController = async (chainId, provider) => {
19
+ const getGaugeController = async (chainId, gaugeSystem, provider) => {
19
20
  if (!provider) {
20
21
  const rpc = chains_1.default[chainId].rpcs[0];
21
22
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
23
  }
23
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
24
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
25
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
26
  return contract.gaugeController();
27
27
  };
28
28
  exports.getGaugeController = getGaugeController;
@@ -6,24 +6,25 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLastClaimedEpoch = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the last epoch claimed for a gauge.
12
+ * Returns the epoch a gauge's next claim starts walking from.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
- * @param gauge - Address of the gauge.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
16
+ * @param gaugeAddressOrId - Address or config id of the gauge.
16
17
  * @param provider - Optional ethers.js Provider instance.
17
- * @returns Last claimed epoch (bigint).
18
+ * @returns The epoch timestamp, seconds.
18
19
  */
19
- const getLastClaimedEpoch = async (chainId, gauge, provider) => {
20
+ const getLastClaimedEpoch = async (chainId, gaugeSystem, gaugeAddressOrId, provider) => {
20
21
  if (!provider) {
21
22
  const rpc = chains_1.default[chainId].rpcs[0];
22
23
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
24
  }
24
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
25
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
26
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
27
- return contract.lastClaimedEpoch(gauge);
25
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
26
+ const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
27
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
28
+ return contract.lastClaimedEpoch(gaugeAddress);
28
29
  };
29
30
  exports.getLastClaimedEpoch = getLastClaimedEpoch;
@@ -0,0 +1,29 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.getMaxClaimBound = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const chains_1 = __importDefault(require("../../../configs/chains"));
9
+ const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
+ /**
12
+ * Reads whether claim walks are capped and the cap in epochs.
13
+ *
14
+ * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
16
+ * @param provider - Optional ethers.js Provider instance.
17
+ * @returns enabled flag and maxEpochs.
18
+ */
19
+ const getMaxClaimBound = async (chainId, gaugeSystem, provider) => {
20
+ if (!provider) {
21
+ const rpc = chains_1.default[chainId].rpcs[0];
22
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
+ }
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
+ const [enabled, maxEpochs] = await Promise.all([contract.enableMaxClaimBound(), contract.MAX_EPOCHS()]);
27
+ return { enabled, maxEpochs };
28
+ };
29
+ exports.getMaxClaimBound = getMaxClaimBound;
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getPeriodDuration = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the distributor's period (epoch) duration in seconds.
12
+ * Returns the distributor's period duration.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param provider - Optional ethers.js Provider instance.
16
- * @returns Period duration in seconds (bigint).
17
+ * @returns The period duration, seconds.
17
18
  */
18
- const getPeriodDuration = async (chainId, provider) => {
19
+ const getPeriodDuration = async (chainId, gaugeSystem, provider) => {
19
20
  if (!provider) {
20
21
  const rpc = chains_1.default[chainId].rpcs[0];
21
22
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
23
  }
23
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
24
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
25
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
26
  return contract.PERIOD_DURATION();
27
27
  };
28
28
  exports.getPeriodDuration = getPeriodDuration;
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRewardToken = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets the reward token address used by the distributor.
12
+ * Returns the single reward token the distributor pays out.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param provider - Optional ethers.js Provider instance.
16
- * @returns Reward token address (string).
17
+ * @returns The reward token address.
17
18
  */
18
- const getRewardToken = async (chainId, provider) => {
19
+ const getRewardToken = async (chainId, gaugeSystem, provider) => {
19
20
  if (!provider) {
20
21
  const rpc = chains_1.default[chainId].rpcs[0];
21
22
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
23
  }
23
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
24
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
25
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
26
  return contract.rewardToken();
27
27
  };
28
28
  exports.getRewardToken = getRewardToken;
@@ -6,23 +6,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRewardTokenInfo = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Gets aggregate statistics for the distributor's reward token.
12
+ * Reads the reward token totals and the distributor's current token balance.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param provider - Optional ethers.js Provider instance.
16
- * @returns Object with totalDeposited, totalDistributed, totalClaimable and balance (all bigint).
17
+ * @returns totalDeposited, totalDistributed, totalClaimable and balance, base units.
17
18
  */
18
- const getRewardTokenInfo = async (chainId, provider) => {
19
+ const getRewardTokenInfo = async (chainId, gaugeSystem, provider) => {
19
20
  if (!provider) {
20
21
  const rpc = chains_1.default[chainId].rpcs[0];
21
22
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
23
  }
23
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
24
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
25
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
24
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
25
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
26
26
  const [totalDeposited, totalDistributed, totalClaimable, balance] = await contract.getRewardTokenInfo();
27
27
  return { totalDeposited, totalDistributed, totalClaimable, balance };
28
28
  };
@@ -6,24 +6,24 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getRewardTokenStats = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
- const getContractAddress_1 = require("../../getContractAddress");
10
9
  const artifacts_1 = require("../../../utils/artifacts");
10
+ const _helpers_1 = require("../gaugeSystems/_helpers");
11
11
  /**
12
- * Reads the rewardTokenInfo mapping entry for a given token.
12
+ * Reads the `rewardTokenInfo` mapping entry for a token.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
15
16
  * @param token - Address of the reward token.
16
17
  * @param provider - Optional ethers.js Provider instance.
17
- * @returns Object with totalDeposited, totalDistributed and totalClaimable (all bigint).
18
+ * @returns totalDeposited, totalDistributed and totalClaimable, base units.
18
19
  */
19
- const getRewardTokenStats = async (chainId, token, provider) => {
20
+ const getRewardTokenStats = async (chainId, gaugeSystem, token, provider) => {
20
21
  if (!provider) {
21
22
  const rpc = chains_1.default[chainId].rpcs[0];
22
23
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
24
  }
24
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
25
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
26
- const contract = new ethers_1.ethers.Contract(address, abi, provider);
25
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
26
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), provider);
27
27
  const [totalDeposited, totalDistributed, totalClaimable] = await contract.rewardTokenInfo(token);
28
28
  return { totalDeposited, totalDistributed, totalClaimable };
29
29
  };
@@ -21,13 +21,16 @@ __exportStar(require("./deposit"), exports);
21
21
  __exportStar(require("./getClaimableForGauge"), exports);
22
22
  __exportStar(require("./getClaimedAtEpoch"), exports);
23
23
  __exportStar(require("./getDepositedAtEpoch"), exports);
24
+ __exportStar(require("./getDustLastProcessedEpoch"), exports);
24
25
  __exportStar(require("./getGaugeController"), exports);
25
26
  __exportStar(require("./getLastClaimedEpoch"), exports);
27
+ __exportStar(require("./getMaxClaimBound"), exports);
26
28
  __exportStar(require("./getPeriodDuration"), exports);
27
29
  __exportStar(require("./getRewardToken"), exports);
28
30
  __exportStar(require("./getRewardTokenInfo"), exports);
29
31
  __exportStar(require("./getRewardTokenStats"), exports);
30
- __exportStar(require("./getStartEpoch"), exports);
31
32
  __exportStar(require("./setController"), exports);
33
+ __exportStar(require("./setLastClaimedEpoch"), exports);
34
+ __exportStar(require("./setMaxClaimBound"), exports);
35
+ __exportStar(require("./withdrawDust"), exports);
32
36
  __exportStar(require("./withdrawRemovedGaugeRewards"), exports);
33
- __exportStar(require("./withdrawUnallocatedRewards"), exports);
@@ -2,25 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.setController = void 0;
4
4
  const ethers_1 = require("ethers");
5
- const getContractAddress_1 = require("../../getContractAddress");
6
5
  const artifacts_1 = require("../../../utils/artifacts");
6
+ const _helpers_1 = require("../gaugeSystems/_helpers");
7
+ const _helpers_2 = require("../_helpers");
7
8
  /**
8
- * Sets the gauge controller for the distributor.
9
- * Requires DEFAULT_ADMIN_ROLE.
9
+ * Points the distributor at a different GaugeController. Requires DEFAULT_ADMIN_ROLE.
10
10
  *
11
11
  * @param chainId - The chain/network to use.
12
- * @param controller - Address of the new gauge controller.
12
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
13
+ * @param controller - Address of the new controller.
13
14
  * @param signer - An ethers.js Signer instance (required).
14
- * @returns Transaction after it has been mined.
15
+ * @returns The transaction after it has been mined.
15
16
  */
16
- const setController = async (chainId, controller, signer) => {
17
+ const setController = async (chainId, gaugeSystem, controller, signer) => {
17
18
  if (!signer)
18
19
  throw new Error("Signer is required");
19
- const address = (0, getContractAddress_1.getContractAddress)(chainId, "gaugerewardsdistributor");
20
- const abi = (0, artifacts_1.getABI)("gaugerewardsdistributor");
21
- const contract = new ethers_1.ethers.Contract(address, abi, signer);
22
- const tx = await contract.setController(controller);
23
- await tx.wait();
24
- return tx;
20
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
21
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), signer);
22
+ try {
23
+ const tx = await contract.setController(controller);
24
+ await tx.wait();
25
+ return tx;
26
+ }
27
+ catch (error) {
28
+ throw (0, _helpers_2.toGovernanceTxError)("Failed to set controller", error);
29
+ }
25
30
  };
26
31
  exports.setController = setController;
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setLastClaimedEpoch = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const artifacts_1 = require("../../../utils/artifacts");
6
+ const _helpers_1 = require("../gaugeSystems/_helpers");
7
+ const _helpers_2 = require("../_helpers");
8
+ /**
9
+ * Bootstraps a new gauge's claim checkpoint. Requires CONTROLLER_ROLE; the controller calls it from `addGauge`.
10
+ *
11
+ * @param chainId - The chain/network to use.
12
+ * @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeRewardsDistributor address.
13
+ * @param gaugeAddressOrId - Address or config id of the gauge.
14
+ * @param signer - An ethers.js Signer instance (required).
15
+ * @returns The transaction after it has been mined.
16
+ */
17
+ const setLastClaimedEpoch = async (chainId, gaugeSystem, gaugeAddressOrId, signer) => {
18
+ if (!signer)
19
+ throw new Error("Signer is required");
20
+ const address = (0, _helpers_1.resolveGaugeDistributor)(chainId, gaugeSystem);
21
+ const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
22
+ const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugerewardsdistributor"), signer);
23
+ try {
24
+ const tx = await contract.setLastClaimedEpoch(gaugeAddress);
25
+ await tx.wait();
26
+ return tx;
27
+ }
28
+ catch (error) {
29
+ throw (0, _helpers_2.toGovernanceTxError)("Failed to set last claimed epoch", error);
30
+ }
31
+ };
32
+ exports.setLastClaimedEpoch = setLastClaimedEpoch;