@raac/rpc 1.2.0-beta.5 → 1.2.0-beta.7

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 (196) hide show
  1. package/dist/RPCLibrary.js +38 -97
  2. package/dist/artifacts/core/collectors/FeeCollector.sol/FeeCollector.json +2 -2
  3. package/dist/artifacts/core/governance/gauges/BaseGauge.sol/BaseGauge.json +155 -144
  4. package/dist/artifacts/core/governance/gauges/GaugeController.sol/GaugeController.json +119 -335
  5. package/dist/artifacts/core/governance/gauges/GaugeRewardsDistributor.sol/GaugeRewardsDistributor.json +104 -325
  6. package/dist/artifacts/core/governance/gauges/RAACGauge.sol/RAACGauge.json +167 -146
  7. package/dist/artifacts/core/governance/gauges/RWAGauge.sol/RWAGauge.json +167 -146
  8. package/dist/artifacts/core/governance/proposals/Governance.sol/Governance.json +2 -2
  9. package/dist/artifacts/core/lockers/RAACLiquidLocker.sol/RAACLiquidLocker.json +2 -2
  10. package/dist/artifacts/core/tokens/veRAACToken.sol/veRAACToken.json +66 -32
  11. package/dist/configs/chains/11155111.json +83 -16
  12. package/dist/configs/chains/8453.json +6 -6
  13. package/dist/contracts/getContractAddress.js +1 -0
  14. package/dist/contracts/governance/distributor/claimAll.js +25 -0
  15. package/dist/contracts/governance/distributor/claimForGauge.js +26 -0
  16. package/dist/contracts/governance/distributor/deposit.js +12 -21
  17. package/dist/contracts/governance/distributor/getClaimableForGauge.js +29 -0
  18. package/dist/contracts/governance/distributor/getClaimedAtEpoch.js +30 -0
  19. package/dist/contracts/governance/distributor/getDepositedAtEpoch.js +30 -0
  20. package/dist/contracts/governance/distributor/getGaugeController.js +28 -0
  21. package/dist/contracts/governance/distributor/getLastClaimedEpoch.js +29 -0
  22. package/dist/contracts/governance/distributor/getPeriodDuration.js +28 -0
  23. package/dist/contracts/governance/distributor/{getRewardTokens.js → getRewardToken.js} +10 -9
  24. package/dist/contracts/governance/distributor/getRewardTokenInfo.js +9 -19
  25. package/dist/contracts/governance/distributor/getRewardTokenStats.js +30 -0
  26. package/dist/contracts/governance/{gaugeController/isGauge.js → distributor/getStartEpoch.js} +10 -10
  27. package/dist/contracts/governance/distributor/index.js +31 -17
  28. package/dist/contracts/governance/distributor/setController.js +26 -0
  29. package/dist/contracts/governance/distributor/withdrawRemovedGaugeRewards.js +27 -0
  30. package/dist/contracts/governance/distributor/withdrawUnallocatedRewards.js +26 -0
  31. package/dist/contracts/governance/gauge/addRewardToken.js +34 -0
  32. package/dist/contracts/governance/gauge/claimExtraReward.js +34 -0
  33. package/dist/contracts/governance/gauge/claimExtraRewards.js +33 -0
  34. package/dist/contracts/governance/gauge/claimOnBehalfOf.js +36 -0
  35. package/dist/contracts/governance/gauge/claimRewardToken.js +3 -4
  36. package/dist/contracts/governance/gauge/claimRewardsFor.js +34 -0
  37. package/dist/contracts/governance/gauge/depositRewardToken.js +35 -0
  38. package/dist/contracts/governance/gauge/getAllPendingExtraRewards.js +36 -0
  39. package/dist/contracts/governance/gauge/getControllerAddress.js +34 -0
  40. package/dist/contracts/governance/gauge/getDecimalAdjustment.js +35 -0
  41. package/dist/contracts/governance/gauge/getDepositRAACOnClaim.js +34 -0
  42. package/dist/contracts/governance/gauge/getDistributorData.js +36 -0
  43. package/dist/contracts/governance/gauge/getDistributors.js +34 -0
  44. package/dist/contracts/governance/gauge/getEarnedReward.js +11 -19
  45. package/dist/contracts/governance/gauge/getExtraRewardTokens.js +34 -0
  46. package/dist/contracts/governance/gauge/getGaugeRewardTokenData.js +44 -0
  47. package/dist/contracts/governance/gauge/getPendingExtraRewards.js +36 -0
  48. package/dist/contracts/governance/gauge/getPendingRewards.js +11 -19
  49. package/dist/contracts/governance/gauge/getRaacAutolockMin.js +34 -0
  50. package/dist/contracts/governance/gauge/getUserRewardTokenData.js +37 -0
  51. package/dist/contracts/governance/gauge/getUserWeight.js +35 -0
  52. package/dist/contracts/governance/gauge/index.js +53 -35
  53. package/dist/contracts/governance/gauge/isPaused.js +34 -0
  54. package/dist/contracts/governance/gauge/manageDistributor.js +35 -0
  55. package/dist/contracts/governance/gauge/setController.js +34 -0
  56. package/dist/contracts/governance/gauge/setDepositRAACOnClaim.js +34 -0
  57. package/dist/contracts/governance/gauge/setDistributorApproval.js +35 -0
  58. package/dist/contracts/governance/gauge/setEmergencyPaused.js +34 -0
  59. package/dist/contracts/governance/gauge/setGaugeRewardDistributor.js +34 -0
  60. package/dist/contracts/governance/gauge/setRaacAutolockMin.js +34 -0
  61. package/dist/contracts/governance/gauge/updateUserRewards.js +3 -2
  62. package/dist/contracts/governance/gaugeController/addGauge.js +24 -0
  63. package/dist/contracts/governance/gaugeController/batchVote.js +25 -0
  64. package/dist/contracts/governance/gaugeController/forceCompleteCheckpoint.js +24 -0
  65. package/dist/contracts/governance/gaugeController/getConstants.js +45 -0
  66. package/dist/contracts/governance/gaugeController/getCurrentEpoch.js +27 -0
  67. package/dist/contracts/governance/gaugeController/getGauge.js +29 -0
  68. package/dist/contracts/governance/gaugeController/getGaugeEmissions.js +136 -0
  69. package/dist/contracts/governance/gaugeController/getGaugeRelativeWeight.js +29 -0
  70. package/dist/contracts/governance/gaugeController/getGaugeRelativeWeightView.js +30 -0
  71. package/dist/contracts/governance/gaugeController/getLastVoteTime.js +29 -0
  72. package/dist/contracts/governance/gaugeController/getNextEpoch.js +27 -0
  73. package/dist/contracts/governance/gaugeController/getUserGaugeVotePower.js +29 -0
  74. package/dist/contracts/governance/gaugeController/getVeToken.js +27 -0
  75. package/dist/contracts/governance/gaugeController/getVoteUserPower.js +28 -0
  76. package/dist/contracts/governance/gaugeController/getVoteUserSlope.js +30 -0
  77. package/dist/contracts/governance/gaugeController/index.js +44 -23
  78. package/dist/contracts/governance/gaugeController/isPaused.js +27 -0
  79. package/dist/contracts/governance/gaugeController/kick.js +24 -0
  80. package/dist/contracts/governance/gaugeController/removeGauge.js +24 -0
  81. package/dist/contracts/governance/gaugeController/removePowerFromGauge.js +24 -0
  82. package/dist/contracts/governance/gaugeController/setBoostAmplificationEnabled.js +25 -0
  83. package/dist/contracts/governance/gaugeController/setEmergencyGaugePause.js +25 -0
  84. package/dist/contracts/governance/gaugeController/setEmergencyPause.js +24 -0
  85. package/dist/contracts/lockers/botLocker/unlock.js +4 -1
  86. package/dist/contracts/lockers/maturityVault/harvest.js +3 -2
  87. package/dist/types/RPCLibrary.d.ts +6 -64
  88. package/dist/types/contracts/governance/distributor/claimAll.d.ts +11 -0
  89. package/dist/types/contracts/governance/distributor/claimForGauge.d.ts +12 -0
  90. package/dist/types/contracts/governance/distributor/deposit.d.ts +6 -7
  91. package/dist/types/contracts/governance/distributor/getClaimableForGauge.d.ts +11 -0
  92. package/dist/types/contracts/governance/distributor/getClaimedAtEpoch.d.ts +12 -0
  93. package/dist/types/contracts/governance/distributor/getDepositedAtEpoch.d.ts +12 -0
  94. package/dist/types/contracts/governance/distributor/getGaugeController.d.ts +10 -0
  95. package/dist/types/contracts/governance/distributor/getLastClaimedEpoch.d.ts +11 -0
  96. package/dist/types/contracts/governance/distributor/getPeriodDuration.d.ts +10 -0
  97. package/dist/types/contracts/governance/distributor/{getRewardTokens.d.ts → getRewardToken.d.ts} +3 -3
  98. package/dist/types/contracts/governance/distributor/getRewardTokenInfo.d.ts +8 -10
  99. package/dist/types/contracts/governance/distributor/getRewardTokenStats.d.ts +15 -0
  100. package/dist/types/contracts/governance/distributor/getStartEpoch.d.ts +10 -0
  101. package/dist/types/contracts/governance/distributor/index.d.ts +16 -8
  102. package/dist/types/contracts/governance/distributor/setController.d.ts +12 -0
  103. package/dist/types/contracts/governance/distributor/withdrawRemovedGaugeRewards.d.ts +13 -0
  104. package/dist/types/contracts/governance/distributor/withdrawUnallocatedRewards.d.ts +12 -0
  105. package/dist/types/contracts/governance/gauge/addRewardToken.d.ts +10 -0
  106. package/dist/types/contracts/governance/gauge/claimExtraReward.d.ts +10 -0
  107. package/dist/types/contracts/governance/gauge/claimExtraRewards.d.ts +9 -0
  108. package/dist/types/contracts/governance/gauge/claimOnBehalfOf.d.ts +12 -0
  109. package/dist/types/contracts/governance/gauge/claimRewardToken.d.ts +1 -2
  110. package/dist/types/contracts/governance/gauge/claimRewardsFor.d.ts +10 -0
  111. package/dist/types/contracts/governance/gauge/depositRewardToken.d.ts +11 -0
  112. package/dist/types/contracts/governance/gauge/getAllPendingExtraRewards.d.ts +13 -0
  113. package/dist/types/contracts/governance/gauge/getControllerAddress.d.ts +9 -0
  114. package/dist/types/contracts/governance/gauge/getDecimalAdjustment.d.ts +10 -0
  115. package/dist/types/contracts/governance/gauge/getDepositRAACOnClaim.d.ts +9 -0
  116. package/dist/types/contracts/governance/gauge/getDistributorData.d.ts +13 -0
  117. package/dist/types/contracts/governance/gauge/{getRewardTokens.d.ts → getDistributors.d.ts} +3 -5
  118. package/dist/types/contracts/governance/gauge/getEarnedReward.d.ts +4 -5
  119. package/dist/types/contracts/governance/gauge/getExtraRewardTokens.d.ts +9 -0
  120. package/dist/types/contracts/governance/gauge/getGaugeRewardTokenData.d.ts +18 -0
  121. package/dist/types/contracts/governance/gauge/getPendingExtraRewards.d.ts +11 -0
  122. package/dist/types/contracts/governance/gauge/getPendingRewards.d.ts +4 -5
  123. package/dist/types/contracts/governance/gauge/getRaacAutolockMin.d.ts +9 -0
  124. package/dist/types/contracts/governance/gauge/getUserRewardTokenData.d.ts +17 -0
  125. package/dist/types/contracts/governance/gauge/getUserWeight.d.ts +10 -0
  126. package/dist/types/contracts/governance/gauge/index.d.ts +38 -17
  127. package/dist/types/contracts/governance/gauge/isPaused.d.ts +9 -0
  128. package/dist/types/contracts/governance/gauge/manageDistributor.d.ts +11 -0
  129. package/dist/types/contracts/governance/gauge/setController.d.ts +10 -0
  130. package/dist/types/contracts/governance/gauge/setDepositRAACOnClaim.d.ts +10 -0
  131. package/dist/types/contracts/governance/gauge/setDistributorApproval.d.ts +11 -0
  132. package/dist/types/contracts/governance/gauge/setEmergencyPaused.d.ts +10 -0
  133. package/dist/types/contracts/governance/gauge/setGaugeRewardDistributor.d.ts +10 -0
  134. package/dist/types/contracts/governance/gauge/setRaacAutolockMin.d.ts +10 -0
  135. package/dist/types/contracts/governance/gauge/updateUserRewards.d.ts +2 -1
  136. package/dist/types/contracts/governance/gaugeController/addGauge.d.ts +10 -0
  137. package/dist/types/contracts/governance/gaugeController/batchVote.d.ts +11 -0
  138. package/dist/types/contracts/governance/gaugeController/forceCompleteCheckpoint.d.ts +10 -0
  139. package/dist/types/contracts/governance/gaugeController/getConstants.d.ts +18 -0
  140. package/dist/types/contracts/governance/gaugeController/getCurrentEpoch.d.ts +9 -0
  141. package/dist/types/contracts/governance/gaugeController/getGauge.d.ts +15 -0
  142. package/dist/types/contracts/governance/gaugeController/getGaugeEmissions.d.ts +51 -0
  143. package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeight.d.ts +15 -0
  144. package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeightView.d.ts +14 -0
  145. package/dist/types/contracts/governance/gaugeController/getLastVoteTime.d.ts +11 -0
  146. package/dist/types/contracts/governance/gaugeController/getNextEpoch.d.ts +9 -0
  147. package/dist/types/contracts/governance/gaugeController/getUserGaugeVotePower.d.ts +11 -0
  148. package/dist/types/contracts/governance/gaugeController/getVeToken.d.ts +9 -0
  149. package/dist/types/contracts/governance/gaugeController/getVoteUserPower.d.ts +10 -0
  150. package/dist/types/contracts/governance/gaugeController/getVoteUserSlope.d.ts +15 -0
  151. package/dist/types/contracts/governance/gaugeController/index.d.ts +29 -11
  152. package/dist/types/contracts/governance/gaugeController/isPaused.d.ts +9 -0
  153. package/dist/types/contracts/governance/gaugeController/kick.d.ts +10 -0
  154. package/dist/types/contracts/governance/gaugeController/removeGauge.d.ts +10 -0
  155. package/dist/types/contracts/governance/gaugeController/removePowerFromGauge.d.ts +10 -0
  156. package/dist/types/contracts/governance/gaugeController/setBoostAmplificationEnabled.d.ts +11 -0
  157. package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePause.d.ts +11 -0
  158. package/dist/types/contracts/governance/gaugeController/setEmergencyPause.d.ts +10 -0
  159. package/dist/types/contracts/lockers/botLocker/unlock.d.ts +3 -0
  160. package/dist/types/contracts/lockers/maturityVault/harvest.d.ts +1 -1
  161. package/dist/utils/contracts.js +1 -1
  162. package/package.json +1 -1
  163. package/dist/contracts/governance/distributor/getAvailableBalance.js +0 -29
  164. package/dist/contracts/governance/distributor/getGaugeRewardTokens.js +0 -28
  165. package/dist/contracts/governance/distributor/getTransferableBalance.js +0 -30
  166. package/dist/contracts/governance/distributor/isRewardTokenApproved.js +0 -29
  167. package/dist/contracts/governance/distributor/isTokenApproved.js +0 -29
  168. package/dist/contracts/governance/gauge/claimReward.js +0 -44
  169. package/dist/contracts/governance/gauge/getAllEarnedRewards.js +0 -51
  170. package/dist/contracts/governance/gauge/getAllPendingRewards.js +0 -41
  171. package/dist/contracts/governance/gauge/getRewardTokens.js +0 -41
  172. package/dist/contracts/governance/gauge/getUserGaugeVoteWeight.js +0 -42
  173. package/dist/contracts/governance/gauge/getWorkingBalance.js +0 -43
  174. package/dist/contracts/governance/gauge/syncRewardTokens.js +0 -51
  175. package/dist/contracts/governance/gaugeController/checkpoint.js +0 -33
  176. package/dist/contracts/governance/gaugeController/checkpointGauge.js +0 -34
  177. package/dist/contracts/governance/gaugeController/getUserGaugeVoteWeight.js +0 -30
  178. package/dist/tests/liquidLocker.test.js +0 -262
  179. package/dist/tests/test.js +0 -32
  180. package/dist/types/contracts/governance/distributor/getAvailableBalance.d.ts +0 -11
  181. package/dist/types/contracts/governance/distributor/getGaugeRewardTokens.d.ts +0 -11
  182. package/dist/types/contracts/governance/distributor/getTransferableBalance.d.ts +0 -12
  183. package/dist/types/contracts/governance/distributor/isRewardTokenApproved.d.ts +0 -12
  184. package/dist/types/contracts/governance/distributor/isTokenApproved.d.ts +0 -11
  185. package/dist/types/contracts/governance/gauge/claimReward.d.ts +0 -11
  186. package/dist/types/contracts/governance/gauge/getAllEarnedRewards.d.ts +0 -17
  187. package/dist/types/contracts/governance/gauge/getAllPendingRewards.d.ts +0 -19
  188. package/dist/types/contracts/governance/gauge/getUserGaugeVoteWeight.d.ts +0 -14
  189. package/dist/types/contracts/governance/gauge/getWorkingBalance.d.ts +0 -12
  190. package/dist/types/contracts/governance/gauge/syncRewardTokens.d.ts +0 -13
  191. package/dist/types/contracts/governance/gaugeController/checkpoint.d.ts +0 -11
  192. package/dist/types/contracts/governance/gaugeController/checkpointGauge.d.ts +0 -12
  193. package/dist/types/contracts/governance/gaugeController/getUserGaugeVoteWeight.d.ts +0 -12
  194. package/dist/types/contracts/governance/gaugeController/isGauge.d.ts +0 -11
  195. package/dist/types/tests/liquidLocker.test.d.ts +0 -18
  196. package/dist/types/tests/test.d.ts +0 -1
@@ -3,26 +3,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isGauge = void 0;
6
+ exports.getStartEpoch = void 0;
7
7
  const ethers_1 = require("ethers");
8
8
  const chains_1 = __importDefault(require("../../../configs/chains"));
9
9
  const getContractAddress_1 = require("../../getContractAddress");
10
- const IS_GAUGE_ABI = "function isGauge(address gauge) view returns (bool)";
10
+ const artifacts_1 = require("../../../utils/artifacts");
11
11
  /**
12
- * Checks if an address is a registered gauge.
12
+ * Gets the distributor's start epoch timestamp.
13
13
  *
14
14
  * @param chainId - The chain/network to use.
15
- * @param gaugeAddress - Address to check.
16
15
  * @param provider - Optional ethers.js Provider instance.
17
- * @returns True if address is a gauge.
16
+ * @returns Start epoch (bigint).
18
17
  */
19
- const isGauge = async (chainId, gaugeAddress, provider) => {
18
+ const getStartEpoch = async (chainId, provider) => {
20
19
  if (!provider) {
21
20
  const rpc = chains_1.default[chainId].rpcs[0];
22
21
  provider = new ethers_1.ethers.JsonRpcProvider(rpc);
23
22
  }
24
- const contractAddress = (0, getContractAddress_1.getContractAddress)(chainId, "gaugecontroller");
25
- const contract = new ethers_1.ethers.Contract(contractAddress, [IS_GAUGE_ABI], provider);
26
- return await contract.isGauge(gaugeAddress);
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);
26
+ return contract.startEpoch();
27
27
  };
28
- exports.isGauge = isGauge;
28
+ exports.getStartEpoch = getStartEpoch;
@@ -1,19 +1,33 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
2
16
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.deposit = exports.getTransferableBalance = exports.getRewardTokens = exports.getRewardTokenInfo = exports.getAvailableBalance = exports.getGaugeRewardTokens = exports.isRewardTokenApproved = exports.isTokenApproved = void 0;
4
- var isTokenApproved_1 = require("./isTokenApproved");
5
- Object.defineProperty(exports, "isTokenApproved", { enumerable: true, get: function () { return isTokenApproved_1.isTokenApproved; } });
6
- var isRewardTokenApproved_1 = require("./isRewardTokenApproved");
7
- Object.defineProperty(exports, "isRewardTokenApproved", { enumerable: true, get: function () { return isRewardTokenApproved_1.isRewardTokenApproved; } });
8
- var getGaugeRewardTokens_1 = require("./getGaugeRewardTokens");
9
- Object.defineProperty(exports, "getGaugeRewardTokens", { enumerable: true, get: function () { return getGaugeRewardTokens_1.getGaugeRewardTokens; } });
10
- var getAvailableBalance_1 = require("./getAvailableBalance");
11
- Object.defineProperty(exports, "getAvailableBalance", { enumerable: true, get: function () { return getAvailableBalance_1.getAvailableBalance; } });
12
- var getRewardTokenInfo_1 = require("./getRewardTokenInfo");
13
- Object.defineProperty(exports, "getRewardTokenInfo", { enumerable: true, get: function () { return getRewardTokenInfo_1.getRewardTokenInfo; } });
14
- var getRewardTokens_1 = require("./getRewardTokens");
15
- Object.defineProperty(exports, "getRewardTokens", { enumerable: true, get: function () { return getRewardTokens_1.getRewardTokens; } });
16
- var getTransferableBalance_1 = require("./getTransferableBalance");
17
- Object.defineProperty(exports, "getTransferableBalance", { enumerable: true, get: function () { return getTransferableBalance_1.getTransferableBalance; } });
18
- var deposit_1 = require("./deposit");
19
- Object.defineProperty(exports, "deposit", { enumerable: true, get: function () { return deposit_1.deposit; } });
17
+ // Auto-generated barrel: re-exports every method in this namespace.
18
+ __exportStar(require("./claimAll"), exports);
19
+ __exportStar(require("./claimForGauge"), exports);
20
+ __exportStar(require("./deposit"), exports);
21
+ __exportStar(require("./getClaimableForGauge"), exports);
22
+ __exportStar(require("./getClaimedAtEpoch"), exports);
23
+ __exportStar(require("./getDepositedAtEpoch"), exports);
24
+ __exportStar(require("./getGaugeController"), exports);
25
+ __exportStar(require("./getLastClaimedEpoch"), exports);
26
+ __exportStar(require("./getPeriodDuration"), exports);
27
+ __exportStar(require("./getRewardToken"), exports);
28
+ __exportStar(require("./getRewardTokenInfo"), exports);
29
+ __exportStar(require("./getRewardTokenStats"), exports);
30
+ __exportStar(require("./getStartEpoch"), exports);
31
+ __exportStar(require("./setController"), exports);
32
+ __exportStar(require("./withdrawRemovedGaugeRewards"), exports);
33
+ __exportStar(require("./withdrawUnallocatedRewards"), exports);
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setController = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const getContractAddress_1 = require("../../getContractAddress");
6
+ const artifacts_1 = require("../../../utils/artifacts");
7
+ /**
8
+ * Sets the gauge controller for the distributor.
9
+ * Requires DEFAULT_ADMIN_ROLE.
10
+ *
11
+ * @param chainId - The chain/network to use.
12
+ * @param controller - Address of the new gauge controller.
13
+ * @param signer - An ethers.js Signer instance (required).
14
+ * @returns Transaction after it has been mined.
15
+ */
16
+ const setController = async (chainId, controller, signer) => {
17
+ if (!signer)
18
+ 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;
25
+ };
26
+ exports.setController = setController;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withdrawRemovedGaugeRewards = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const getContractAddress_1 = require("../../getContractAddress");
6
+ const artifacts_1 = require("../../../utils/artifacts");
7
+ /**
8
+ * Withdraws rewards belonging to a removed gauge to a recipient.
9
+ * Requires DEFAULT_ADMIN_ROLE.
10
+ *
11
+ * @param chainId - The chain/network to use.
12
+ * @param gauge - Address of the removed gauge.
13
+ * @param recipient - Address to receive the withdrawn rewards.
14
+ * @param signer - An ethers.js Signer instance (required).
15
+ * @returns Transaction after it has been mined.
16
+ */
17
+ const withdrawRemovedGaugeRewards = async (chainId, gauge, recipient, signer) => {
18
+ if (!signer)
19
+ 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.withdrawRemovedGaugeRewards(gauge, recipient);
24
+ await tx.wait();
25
+ return tx;
26
+ };
27
+ exports.withdrawRemovedGaugeRewards = withdrawRemovedGaugeRewards;
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withdrawUnallocatedRewards = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const getContractAddress_1 = require("../../getContractAddress");
6
+ const artifacts_1 = require("../../../utils/artifacts");
7
+ /**
8
+ * Withdraws unallocated rewards to a recipient.
9
+ * Requires DEFAULT_ADMIN_ROLE.
10
+ *
11
+ * @param chainId - The chain/network to use.
12
+ * @param recipient - Address to receive the withdrawn rewards.
13
+ * @param signer - An ethers.js Signer instance (required).
14
+ * @returns Transaction after it has been mined.
15
+ */
16
+ const withdrawUnallocatedRewards = async (chainId, recipient, signer) => {
17
+ if (!signer)
18
+ 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.withdrawUnallocatedRewards(recipient);
23
+ await tx.wait();
24
+ return tx;
25
+ };
26
+ exports.withdrawUnallocatedRewards = withdrawUnallocatedRewards;
@@ -0,0 +1,34 @@
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.addRewardToken = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Registers a new reward token on the gauge (requires GAUGE_ADMIN).
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param token - Address of the reward token to add.
15
+ * @param signer - An ethers.js Signer instance (required).
16
+ */
17
+ const addRewardToken = async (chainId, gaugeAddressOrId, token, signer) => {
18
+ if (!signer)
19
+ throw new Error("Signer is required");
20
+ let gaugeAddress;
21
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
22
+ gaugeAddress = gaugeAddressOrId;
23
+ }
24
+ else {
25
+ // @ts-ignore
26
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
27
+ }
28
+ const abi = (0, artifacts_1.getABI)("basegauge");
29
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
30
+ const tx = await contract.addRewardToken(token);
31
+ await tx.wait();
32
+ return tx;
33
+ };
34
+ exports.addRewardToken = addRewardToken;
@@ -0,0 +1,34 @@
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.claimExtraReward = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Claims a single extra reward token for the caller on the given gauge.
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param token - Address of the extra reward token to claim.
15
+ * @param signer - An ethers.js Signer instance (required).
16
+ */
17
+ const claimExtraReward = async (chainId, gaugeAddressOrId, token, signer) => {
18
+ if (!signer)
19
+ throw new Error("Signer is required");
20
+ let gaugeAddress;
21
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
22
+ gaugeAddress = gaugeAddressOrId;
23
+ }
24
+ else {
25
+ // @ts-ignore
26
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
27
+ }
28
+ const abi = (0, artifacts_1.getABI)("basegauge");
29
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
30
+ const tx = await contract.claimExtraReward(token);
31
+ await tx.wait();
32
+ return tx;
33
+ };
34
+ exports.claimExtraReward = claimExtraReward;
@@ -0,0 +1,33 @@
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.claimExtraRewards = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Claims all extra reward tokens for the caller on the given gauge.
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param signer - An ethers.js Signer instance (required).
15
+ */
16
+ const claimExtraRewards = async (chainId, gaugeAddressOrId, signer) => {
17
+ if (!signer)
18
+ throw new Error("Signer is required");
19
+ let gaugeAddress;
20
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
21
+ gaugeAddress = gaugeAddressOrId;
22
+ }
23
+ else {
24
+ // @ts-ignore
25
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
26
+ }
27
+ const abi = (0, artifacts_1.getABI)("basegauge");
28
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
29
+ const tx = await contract.claimExtraRewards();
30
+ await tx.wait();
31
+ return tx;
32
+ };
33
+ exports.claimExtraRewards = claimExtraRewards;
@@ -0,0 +1,36 @@
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.claimOnBehalfOf = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Claims a specific token amount on behalf of a user (requires CLAIM_FOR_ROLE).
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param token - Address of the reward token.
15
+ * @param amount - The amount to claim.
16
+ * @param user - Address of the user on whose behalf the claim is made.
17
+ * @param signer - An ethers.js Signer instance (required).
18
+ */
19
+ const claimOnBehalfOf = async (chainId, gaugeAddressOrId, token, amount, user, signer) => {
20
+ if (!signer)
21
+ throw new Error("Signer is required");
22
+ let gaugeAddress;
23
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
24
+ gaugeAddress = gaugeAddressOrId;
25
+ }
26
+ else {
27
+ // @ts-ignore
28
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
29
+ }
30
+ const abi = (0, artifacts_1.getABI)("basegauge");
31
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
32
+ const tx = await contract.claimOnBehalfOf(token, amount, user);
33
+ await tx.wait();
34
+ return tx;
35
+ };
36
+ exports.claimOnBehalfOf = claimOnBehalfOf;
@@ -12,11 +12,10 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
12
12
  *
13
13
  * @param chainId - The chain/network to use.
14
14
  * @param gaugeAddressOrId - Address of the gauge contract or ID of the gauge.
15
- * @param tokenAddress - Address of the reward token to claim.
16
15
  * @param signer - An ethers.js Signer instance (must be connected to wallet).
17
16
  * @returns Transaction receipt after the claim is made.
18
17
  */
19
- const claimRewardToken = async (chainId, gaugeAddressOrId, tokenAddress, signer) => {
18
+ const claimRewardToken = async (chainId, gaugeAddressOrId, signer) => {
20
19
  if (!signer) {
21
20
  throw new Error("Signer is required");
22
21
  }
@@ -31,9 +30,9 @@ const claimRewardToken = async (chainId, gaugeAddressOrId, tokenAddress, signer)
31
30
  }
32
31
  const gaugeABI = (0, artifacts_1.getABI)("basegauge");
33
32
  const contract = new ethers_1.ethers.Contract(gaugeAddress, gaugeABI, signer);
34
- const tx = await contract.claimRewardToken(tokenAddress);
33
+ const tx = await contract.claimRewardToken();
35
34
  await tx.wait();
36
- console.log(`Claimed reward token ${tokenAddress} from gauge: ${gaugeAddress}`);
35
+ console.log(`Claimed main reward token from gauge: ${gaugeAddress}`);
37
36
  return tx;
38
37
  }
39
38
  catch (error) {
@@ -0,0 +1,34 @@
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.claimRewardsFor = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Claims rewards on behalf of a user (requires DISTRIBUTOR_ROLE).
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param user - Address of the user whose rewards are claimed.
15
+ * @param signer - An ethers.js Signer instance (required).
16
+ */
17
+ const claimRewardsFor = async (chainId, gaugeAddressOrId, user, signer) => {
18
+ if (!signer)
19
+ throw new Error("Signer is required");
20
+ let gaugeAddress;
21
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
22
+ gaugeAddress = gaugeAddressOrId;
23
+ }
24
+ else {
25
+ // @ts-ignore
26
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
27
+ }
28
+ const abi = (0, artifacts_1.getABI)("basegauge");
29
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
30
+ const tx = await contract.claimRewardsFor(user);
31
+ await tx.wait();
32
+ return tx;
33
+ };
34
+ exports.claimRewardsFor = claimRewardsFor;
@@ -0,0 +1,35 @@
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.depositRewardToken = void 0;
7
+ const ethers_1 = require("ethers");
8
+ const artifacts_1 = require("../../../utils/artifacts");
9
+ const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
10
+ /**
11
+ * Deposits an amount of a reward token into the gauge for distribution.
12
+ * @param chainId - The chain/network to use.
13
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
14
+ * @param token - Address of the reward token to deposit.
15
+ * @param amount - The amount to deposit.
16
+ * @param signer - An ethers.js Signer instance (required).
17
+ */
18
+ const depositRewardToken = async (chainId, gaugeAddressOrId, token, amount, signer) => {
19
+ if (!signer)
20
+ throw new Error("Signer is required");
21
+ let gaugeAddress;
22
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
23
+ gaugeAddress = gaugeAddressOrId;
24
+ }
25
+ else {
26
+ // @ts-ignore
27
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
28
+ }
29
+ const abi = (0, artifacts_1.getABI)("basegauge");
30
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
31
+ const tx = await contract.depositRewardToken(token, amount);
32
+ await tx.wait();
33
+ return tx;
34
+ };
35
+ exports.depositRewardToken = depositRewardToken;
@@ -0,0 +1,36 @@
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.getAllPendingExtraRewards = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Gets all pending extra rewards for a user across all extra reward tokens.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param user - Address of the user.
16
+ * @param provider - Optional ethers.js Provider instance.
17
+ */
18
+ const getAllPendingExtraRewards = async (chainId, gaugeAddressOrId, user, provider) => {
19
+ if (!provider) {
20
+ const rpc = chains_1.default[chainId].rpcs[0];
21
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
+ }
23
+ let gaugeAddress;
24
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
25
+ gaugeAddress = gaugeAddressOrId;
26
+ }
27
+ else {
28
+ // @ts-ignore
29
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
30
+ }
31
+ const abi = (0, artifacts_1.getABI)("basegauge");
32
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
33
+ const [tokens, amounts] = await contract.allPendingExtraRewards(user);
34
+ return { tokens, amounts };
35
+ };
36
+ exports.getAllPendingExtraRewards = getAllPendingExtraRewards;
@@ -0,0 +1,34 @@
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.getControllerAddress = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Gets the gauge controller address registered on the gauge.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param provider - Optional ethers.js Provider instance.
16
+ */
17
+ const getControllerAddress = async (chainId, gaugeAddressOrId, provider) => {
18
+ if (!provider) {
19
+ const rpc = chains_1.default[chainId].rpcs[0];
20
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
21
+ }
22
+ let gaugeAddress;
23
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
24
+ gaugeAddress = gaugeAddressOrId;
25
+ }
26
+ else {
27
+ // @ts-ignore
28
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
29
+ }
30
+ const abi = (0, artifacts_1.getABI)("basegauge");
31
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
32
+ return contract.getControllerAddress();
33
+ };
34
+ exports.getControllerAddress = getControllerAddress;
@@ -0,0 +1,35 @@
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.getDecimalAdjustment = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Gets the decimal adjustment factor used for a given reward token.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param token - Address of the reward token.
16
+ * @param provider - Optional ethers.js Provider instance.
17
+ */
18
+ const getDecimalAdjustment = async (chainId, gaugeAddressOrId, token, provider) => {
19
+ if (!provider) {
20
+ const rpc = chains_1.default[chainId].rpcs[0];
21
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
+ }
23
+ let gaugeAddress;
24
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
25
+ gaugeAddress = gaugeAddressOrId;
26
+ }
27
+ else {
28
+ // @ts-ignore
29
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
30
+ }
31
+ const abi = (0, artifacts_1.getABI)("basegauge");
32
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
33
+ return contract.getDecimalAdjustment(token);
34
+ };
35
+ exports.getDecimalAdjustment = getDecimalAdjustment;
@@ -0,0 +1,34 @@
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.getDepositRAACOnClaim = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Returns whether claimed RAAC is auto-deposited (locked) on claim.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param provider - Optional ethers.js Provider instance.
16
+ */
17
+ const getDepositRAACOnClaim = async (chainId, gaugeAddressOrId, provider) => {
18
+ if (!provider) {
19
+ const rpc = chains_1.default[chainId].rpcs[0];
20
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
21
+ }
22
+ let gaugeAddress;
23
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
24
+ gaugeAddress = gaugeAddressOrId;
25
+ }
26
+ else {
27
+ // @ts-ignore
28
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
29
+ }
30
+ const abi = (0, artifacts_1.getABI)("basegauge");
31
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
32
+ return contract.depositRAACOnClaim();
33
+ };
34
+ exports.getDepositRAACOnClaim = getDepositRAACOnClaim;
@@ -0,0 +1,36 @@
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.getDistributorData = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Gets the registration data for a given distributor on the gauge.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param distributor - Address of the distributor.
16
+ * @param provider - Optional ethers.js Provider instance.
17
+ */
18
+ const getDistributorData = async (chainId, gaugeAddressOrId, distributor, provider) => {
19
+ if (!provider) {
20
+ const rpc = chains_1.default[chainId].rpcs[0];
21
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
22
+ }
23
+ let gaugeAddress;
24
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
25
+ gaugeAddress = gaugeAddressOrId;
26
+ }
27
+ else {
28
+ // @ts-ignore
29
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
30
+ }
31
+ const abi = (0, artifacts_1.getABI)("basegauge");
32
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
33
+ const [distro, approved] = await contract.getDistributorData(distributor);
34
+ return { distributor: distro, approved };
35
+ };
36
+ exports.getDistributorData = getDistributorData;
@@ -0,0 +1,34 @@
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.getDistributors = 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 getContractAddress_1 = __importDefault(require("../../getContractAddress"));
11
+ /**
12
+ * Gets the list of distributor addresses registered on the gauge.
13
+ * @param chainId - The chain/network to use.
14
+ * @param gaugeAddressOrId - Address of the gauge contract or its config ID.
15
+ * @param provider - Optional ethers.js Provider instance.
16
+ */
17
+ const getDistributors = async (chainId, gaugeAddressOrId, provider) => {
18
+ if (!provider) {
19
+ const rpc = chains_1.default[chainId].rpcs[0];
20
+ provider = new ethers_1.ethers.JsonRpcProvider(rpc);
21
+ }
22
+ let gaugeAddress;
23
+ if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
24
+ gaugeAddress = gaugeAddressOrId;
25
+ }
26
+ else {
27
+ // @ts-ignore
28
+ gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
29
+ }
30
+ const abi = (0, artifacts_1.getABI)("basegauge");
31
+ const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
32
+ return contract.getDistributors();
33
+ };
34
+ exports.getDistributors = getDistributors;