@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.
- package/dist/RPCLibrary.js +2 -0
- package/dist/artifacts/core/governance/gauges/BaseGauge.sol/BaseGauge.json +113 -20
- package/dist/artifacts/core/governance/gauges/GaugeController.sol/GaugeController.json +259 -31
- package/dist/artifacts/core/governance/gauges/GaugeRewardsDistributor.sol/GaugeRewardsDistributor.json +159 -31
- package/dist/artifacts/core/governance/gauges/RAACGauge.sol/RAACGauge.json +115 -22
- package/dist/artifacts/core/governance/gauges/RWAGauge.sol/RWAGauge.json +115 -22
- package/dist/configs/chains/1.json +22 -25
- package/dist/configs/chains/11155111.json +76 -112
- package/dist/configs/chains/17000.json +22 -25
- package/dist/configs/chains/18453.json +22 -25
- package/dist/configs/chains/8453.json +61 -31
- package/dist/contracts/findContract.js +11 -4
- package/dist/contracts/getContractAddress.js +0 -1
- package/dist/contracts/governance/distributor/claimAll.js +18 -11
- package/dist/contracts/governance/distributor/claimForGauge.js +18 -12
- package/dist/contracts/governance/distributor/deposit.js +17 -12
- package/dist/contracts/governance/distributor/getClaimableForGauge.js +10 -9
- package/dist/contracts/governance/distributor/getClaimedAtEpoch.js +11 -10
- package/dist/contracts/governance/distributor/getDepositedAtEpoch.js +8 -8
- package/dist/contracts/governance/distributor/getDustLastProcessedEpoch.js +28 -0
- package/dist/contracts/governance/distributor/getGaugeController.js +7 -7
- package/dist/contracts/governance/distributor/getLastClaimedEpoch.js +10 -9
- package/dist/contracts/governance/distributor/getMaxClaimBound.js +29 -0
- package/dist/contracts/governance/distributor/getPeriodDuration.js +7 -7
- package/dist/contracts/governance/distributor/getRewardToken.js +7 -7
- package/dist/contracts/governance/distributor/getRewardTokenInfo.js +7 -7
- package/dist/contracts/governance/distributor/getRewardTokenStats.js +7 -7
- package/dist/contracts/governance/distributor/index.js +5 -2
- package/dist/contracts/governance/distributor/setController.js +17 -12
- package/dist/contracts/governance/distributor/setLastClaimedEpoch.js +32 -0
- package/dist/contracts/governance/distributor/setMaxClaimBound.js +31 -0
- package/dist/contracts/governance/distributor/withdrawDust.js +31 -0
- package/dist/contracts/governance/distributor/withdrawRemovedGaugeRewards.js +19 -13
- package/dist/contracts/governance/gauge/_apy.js +122 -0
- package/dist/contracts/governance/gauge/_tokens.js +36 -0
- package/dist/contracts/governance/gauge/addRewardToken.js +2 -12
- package/dist/contracts/governance/gauge/approveGaugeToken.js +31 -0
- package/dist/contracts/governance/gauge/claimExtraReward.js +2 -12
- package/dist/contracts/governance/gauge/claimExtraRewards.js +2 -12
- package/dist/contracts/governance/gauge/claimOnBehalfOf.js +2 -12
- package/dist/contracts/governance/gauge/claimRewardToken.js +3 -13
- package/dist/contracts/governance/gauge/claimRewardsFor.js +2 -12
- package/dist/contracts/governance/gauge/depositRewardToken.js +2 -12
- package/dist/contracts/governance/gauge/getAllPendingExtraRewards.js +2 -9
- package/dist/contracts/governance/gauge/getApy.js +44 -0
- package/dist/contracts/governance/gauge/getBalanceOf.js +2 -15
- package/dist/contracts/governance/gauge/getControllerAddress.js +2 -9
- package/dist/contracts/governance/gauge/getDecimalAdjustment.js +2 -9
- package/dist/contracts/governance/gauge/getDepositRAACOnClaim.js +2 -9
- package/dist/contracts/governance/gauge/getDistributorData.js +2 -9
- package/dist/contracts/governance/gauge/getDistributors.js +2 -9
- package/dist/contracts/governance/gauge/getEarnedExtraReward.js +30 -0
- package/dist/contracts/governance/gauge/getEarnedReward.js +8 -14
- package/dist/contracts/governance/gauge/getExtraRewardTokens.js +2 -9
- package/dist/contracts/governance/gauge/getGaugeData.js +39 -0
- package/dist/contracts/governance/gauge/getGaugeRewardTokenData.js +2 -9
- package/dist/contracts/governance/gauge/getPauseStatus.js +31 -0
- package/dist/contracts/governance/gauge/getPendingExtraRewards.js +2 -9
- package/dist/contracts/governance/gauge/getPendingRewards.js +8 -14
- package/dist/contracts/governance/gauge/getPeriodBoundaries.js +2 -15
- package/dist/contracts/governance/gauge/getPeriodDuration.js +2 -15
- package/dist/contracts/governance/gauge/getRaacAutolockMin.js +2 -9
- package/dist/contracts/governance/gauge/getRawBalanceOf.js +2 -15
- package/dist/contracts/governance/gauge/getRawTotalSupply.js +2 -15
- package/dist/contracts/governance/gauge/getRewardTokens.js +28 -0
- package/dist/contracts/governance/gauge/getTotalSupply.js +2 -15
- package/dist/contracts/governance/gauge/getUserApy.js +71 -0
- package/dist/contracts/governance/gauge/getUserClaimableRewards.js +21 -73
- package/dist/contracts/governance/gauge/getUserGaugeState.js +44 -0
- package/dist/contracts/governance/gauge/getUserRewardTokenData.js +2 -9
- package/dist/contracts/governance/gauge/getUserWeight.js +2 -9
- package/dist/contracts/governance/gauge/index.js +11 -1
- package/dist/contracts/governance/gauge/isPaused.js +4 -11
- package/dist/contracts/governance/gauge/manageDistributor.js +2 -12
- package/dist/contracts/governance/gauge/pullRewardsFromDistributor.js +30 -0
- package/dist/contracts/governance/gauge/setController.js +2 -12
- package/dist/contracts/governance/gauge/setDepositRAACOnClaim.js +2 -12
- package/dist/contracts/governance/gauge/setEmergencyPaused.js +2 -12
- package/dist/contracts/governance/gauge/setGaugeRewardDistributor.js +2 -12
- package/dist/contracts/governance/gauge/setRaacAutolockMin.js +2 -12
- package/dist/contracts/governance/gauge/stake.js +2 -18
- package/dist/contracts/governance/gauge/unwrapStakingToken.js +28 -0
- package/dist/contracts/governance/gauge/updateUserRewards.js +2 -18
- package/dist/contracts/governance/gauge/withdraw.js +2 -18
- package/dist/contracts/governance/gauge/wrapStakingToken.js +28 -0
- package/dist/contracts/governance/gaugeController/addGauge.js +19 -11
- package/dist/contracts/governance/gaugeController/batchVote.js +20 -12
- package/dist/contracts/governance/gaugeController/calculateBoost.js +20 -23
- package/dist/contracts/governance/gaugeController/forceCompleteCheckpoint.js +19 -11
- package/dist/contracts/governance/gaugeController/getActiveGaugeCount.js +28 -0
- package/dist/contracts/governance/gaugeController/getActiveGauges.js +10 -13
- package/dist/contracts/governance/gaugeController/getConstants.js +10 -18
- package/dist/contracts/governance/gaugeController/getCurrentEpoch.js +8 -7
- package/dist/contracts/governance/gaugeController/getExpiredGaugeVotePower.js +30 -0
- package/dist/contracts/governance/gaugeController/getGauge.js +11 -9
- package/dist/contracts/governance/gaugeController/getGaugeDistributor.js +28 -0
- package/dist/contracts/governance/gaugeController/getGaugeEmissions.js +15 -9
- package/dist/contracts/governance/gaugeController/getGaugeRelativeWeight.js +19 -15
- package/dist/contracts/governance/gaugeController/getGaugeRelativeWeightView.js +12 -10
- package/dist/contracts/governance/gaugeController/getGaugeWeight.js +10 -8
- package/dist/contracts/governance/gaugeController/getLastVoteTime.js +11 -9
- package/dist/contracts/governance/gaugeController/getMaxVoteBuckets.js +28 -0
- package/dist/contracts/governance/gaugeController/getNextEpoch.js +8 -7
- package/dist/contracts/governance/gaugeController/getRegisteredGaugeList.js +28 -0
- package/dist/contracts/governance/gaugeController/getTotalWeight.js +8 -7
- package/dist/contracts/governance/gaugeController/getUserGaugeVotePower.js +11 -9
- package/dist/contracts/governance/gaugeController/getUserVotePowerRemaining.js +10 -9
- package/dist/contracts/governance/gaugeController/getVeToken.js +8 -7
- package/dist/contracts/governance/gaugeController/getVoteUserLocks.js +32 -0
- package/dist/contracts/governance/gaugeController/getVoteUserPower.js +8 -7
- package/dist/contracts/governance/gaugeController/getVoteUserSlope.js +12 -10
- package/dist/contracts/governance/gaugeController/index.js +10 -1
- package/dist/contracts/governance/gaugeController/isGaugeActive.js +11 -9
- package/dist/contracts/governance/gaugeController/isPaused.js +9 -8
- package/dist/contracts/governance/gaugeController/kick.js +17 -10
- package/dist/contracts/governance/gaugeController/removeGauge.js +20 -11
- package/dist/contracts/governance/gaugeController/removePowerFromGauge.js +19 -11
- package/dist/contracts/governance/gaugeController/setBoostAmplificationEnabled.js +20 -12
- package/dist/contracts/governance/gaugeController/setDistributor.js +31 -0
- package/dist/contracts/governance/gaugeController/setEmergencyGaugePause.js +20 -12
- package/dist/contracts/governance/gaugeController/setEmergencyGaugePauseBatch.js +33 -0
- package/dist/contracts/governance/gaugeController/setEmergencyPause.js +18 -11
- package/dist/contracts/governance/gaugeController/setMaxVoteBuckets.js +31 -0
- package/dist/contracts/governance/gaugeController/vote.js +15 -16
- package/dist/contracts/governance/gaugeSystems/_helpers.js +123 -0
- package/dist/contracts/governance/gaugeSystems/findGauge.js +14 -0
- package/dist/contracts/governance/gaugeSystems/getGaugeSystem.js +14 -0
- package/dist/contracts/governance/gaugeSystems/getGaugeSystems.js +13 -0
- package/dist/contracts/governance/gaugeSystems/getGauges.js +15 -0
- package/dist/contracts/governance/gaugeSystems/index.js +21 -0
- package/dist/types/RPCLibrary.d.ts +2 -0
- package/dist/types/configs/chains/index.d.ts +36 -46
- package/dist/types/configs/index.d.ts +18 -23
- package/dist/types/contracts/governance/distributor/claimAll.d.ts +7 -5
- package/dist/types/contracts/governance/distributor/claimForGauge.d.ts +7 -6
- package/dist/types/contracts/governance/distributor/deposit.d.ts +7 -6
- package/dist/types/contracts/governance/distributor/getClaimableForGauge.d.ts +6 -4
- package/dist/types/contracts/governance/distributor/getClaimedAtEpoch.d.ts +7 -5
- package/dist/types/contracts/governance/distributor/getDepositedAtEpoch.d.ts +6 -4
- package/dist/types/contracts/governance/distributor/getDustLastProcessedEpoch.d.ts +12 -0
- package/dist/types/contracts/governance/distributor/getGaugeController.d.ts +5 -3
- package/dist/types/contracts/governance/distributor/getLastClaimedEpoch.d.ts +6 -4
- package/dist/types/contracts/governance/distributor/getMaxClaimBound.d.ts +15 -0
- package/dist/types/contracts/governance/distributor/getPeriodDuration.d.ts +5 -3
- package/dist/types/contracts/governance/distributor/getRewardToken.d.ts +5 -3
- package/dist/types/contracts/governance/distributor/getRewardTokenInfo.d.ts +5 -3
- package/dist/types/contracts/governance/distributor/getRewardTokenStats.d.ts +5 -3
- package/dist/types/contracts/governance/distributor/index.d.ts +5 -2
- package/dist/types/contracts/governance/distributor/setController.d.ts +7 -6
- package/dist/types/contracts/governance/distributor/setLastClaimedEpoch.d.ts +13 -0
- package/dist/types/contracts/governance/distributor/setMaxClaimBound.d.ts +13 -0
- package/dist/types/contracts/governance/distributor/withdrawDust.d.ts +13 -0
- package/dist/types/contracts/governance/distributor/withdrawRemovedGaugeRewards.d.ts +8 -7
- package/dist/types/contracts/governance/gauge/_apy.d.ts +61 -0
- package/dist/types/contracts/governance/gauge/_tokens.d.ts +14 -0
- package/dist/types/contracts/governance/gauge/approveGaugeToken.d.ts +14 -0
- package/dist/types/contracts/governance/gauge/claimRewardToken.d.ts +1 -1
- package/dist/types/contracts/governance/gauge/getApy.d.ts +41 -0
- package/dist/types/contracts/governance/gauge/getEarnedExtraReward.d.ts +13 -0
- package/dist/types/contracts/governance/gauge/getEarnedReward.d.ts +3 -2
- package/dist/types/contracts/governance/gauge/getGaugeData.d.ts +23 -0
- package/dist/types/contracts/governance/gauge/getPauseStatus.d.ts +19 -0
- package/dist/types/contracts/governance/gauge/getPendingRewards.d.ts +3 -2
- package/dist/types/contracts/governance/gauge/getRewardTokens.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/getUserApy.d.ts +44 -0
- package/dist/types/contracts/governance/gauge/getUserClaimableRewards.d.ts +14 -12
- package/dist/types/contracts/governance/gauge/getUserGaugeState.d.ts +31 -0
- package/dist/types/contracts/governance/gauge/index.d.ts +11 -1
- package/dist/types/contracts/governance/gauge/isPaused.d.ts +1 -1
- package/dist/types/contracts/governance/gauge/pullRewardsFromDistributor.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/unwrapStakingToken.d.ts +12 -0
- package/dist/types/contracts/governance/gauge/wrapStakingToken.d.ts +13 -0
- package/dist/types/contracts/governance/gaugeController/addGauge.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/batchVote.d.ts +9 -6
- package/dist/types/contracts/governance/gaugeController/calculateBoost.d.ts +10 -8
- package/dist/types/contracts/governance/gaugeController/forceCompleteCheckpoint.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/getActiveGaugeCount.d.ts +12 -0
- package/dist/types/contracts/governance/gaugeController/getActiveGauges.d.ts +7 -3
- package/dist/types/contracts/governance/gaugeController/getConstants.d.ts +6 -4
- package/dist/types/contracts/governance/gaugeController/getCurrentEpoch.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/getExpiredGaugeVotePower.d.ts +16 -0
- package/dist/types/contracts/governance/gaugeController/getGauge.d.ts +7 -4
- package/dist/types/contracts/governance/gaugeController/getGaugeDistributor.d.ts +12 -0
- package/dist/types/contracts/governance/gaugeController/getGaugeEmissions.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeight.d.ts +8 -9
- package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeightView.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/getGaugeWeight.d.ts +6 -4
- package/dist/types/contracts/governance/gaugeController/getLastVoteTime.d.ts +7 -4
- package/dist/types/contracts/governance/gaugeController/getMaxVoteBuckets.d.ts +12 -0
- package/dist/types/contracts/governance/gaugeController/getNextEpoch.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/getRegisteredGaugeList.d.ts +12 -0
- package/dist/types/contracts/governance/gaugeController/getTotalWeight.d.ts +5 -3
- package/dist/types/contracts/governance/gaugeController/getUserGaugeVotePower.d.ts +7 -4
- package/dist/types/contracts/governance/gaugeController/getUserVotePowerRemaining.d.ts +6 -4
- package/dist/types/contracts/governance/gaugeController/getVeToken.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/getVoteUserLocks.d.ts +17 -0
- package/dist/types/contracts/governance/gaugeController/getVoteUserPower.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/getVoteUserSlope.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/index.d.ts +10 -1
- package/dist/types/contracts/governance/gaugeController/isGaugeActive.d.ts +6 -4
- package/dist/types/contracts/governance/gaugeController/isPaused.d.ts +6 -3
- package/dist/types/contracts/governance/gaugeController/kick.d.ts +7 -4
- package/dist/types/contracts/governance/gaugeController/removeGauge.d.ts +9 -5
- package/dist/types/contracts/governance/gaugeController/removePowerFromGauge.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/setBoostAmplificationEnabled.d.ts +9 -6
- package/dist/types/contracts/governance/gaugeController/setDistributor.d.ts +13 -0
- package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePause.d.ts +9 -6
- package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePauseBatch.d.ts +14 -0
- package/dist/types/contracts/governance/gaugeController/setEmergencyPause.d.ts +8 -5
- package/dist/types/contracts/governance/gaugeController/setMaxVoteBuckets.d.ts +13 -0
- package/dist/types/contracts/governance/gaugeController/vote.d.ts +9 -7
- package/dist/types/contracts/governance/gaugeSystems/_helpers.d.ts +71 -0
- package/dist/types/contracts/governance/gaugeSystems/findGauge.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeSystems/getGaugeSystem.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeSystems/getGaugeSystems.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeSystems/getGauges.d.ts +13 -0
- package/dist/types/contracts/governance/gaugeSystems/index.d.ts +5 -0
- package/dist/types/typechain-types/contracts/core/governance/gauges/BaseGauge.d.ts +176 -105
- package/dist/types/typechain-types/contracts/core/governance/gauges/GaugeController.d.ts +260 -213
- package/dist/types/typechain-types/contracts/core/governance/gauges/GaugeRewardsDistributor.d.ts +173 -212
- package/dist/types/typechain-types/contracts/core/governance/gauges/RAACGauge.d.ts +176 -105
- package/dist/types/typechain-types/contracts/core/governance/gauges/RWAGauge.d.ts +176 -105
- package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IBaseGauge.d.ts +111 -108
- package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IGaugeController.d.ts +210 -34
- package/dist/types/typechain-types/contracts/interfaces/core/governance/gauges/IGaugeRewardsDistributor.d.ts +112 -151
- package/dist/types/typechain-types/factories/contracts/core/governance/gauges/BaseGauge__factory.d.ts +174 -95
- package/dist/types/typechain-types/factories/contracts/core/governance/gauges/GaugeController__factory.d.ts +243 -227
- package/dist/types/typechain-types/factories/contracts/core/governance/gauges/GaugeRewardsDistributor__factory.d.ts +164 -232
- package/dist/types/typechain-types/factories/contracts/core/governance/gauges/RAACGauge__factory.d.ts +185 -98
- package/dist/types/typechain-types/factories/contracts/core/governance/gauges/RWAGauge__factory.d.ts +185 -98
- package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IBaseGauge__factory.d.ts +104 -95
- package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IGaugeController__factory.d.ts +241 -22
- package/dist/types/typechain-types/factories/contracts/interfaces/core/governance/gauges/IGaugeRewardsDistributor__factory.d.ts +72 -158
- package/dist/types/utils/artifacts.d.ts +40 -0
- package/dist/types/utils/contracts.d.ts +34 -44
- package/dist/utils/contracts.js +1 -1
- package/package.json +1 -1
- package/dist/contracts/governance/distributor/getStartEpoch.js +0 -28
- package/dist/contracts/governance/distributor/withdrawUnallocatedRewards.js +0 -26
- package/dist/contracts/governance/gauge/setDistributorApproval.js +0 -35
- package/dist/types/contracts/governance/distributor/getStartEpoch.d.ts +0 -10
- package/dist/types/contracts/governance/distributor/withdrawUnallocatedRewards.d.ts +0 -12
- package/dist/types/contracts/governance/gauge/setDistributorApproval.d.ts +0 -11
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.kick = 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
|
-
*
|
|
9
|
+
* Writes down the vote weight of a user whose locks have expired. Reverts during a global pause.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
10
13
|
* @param user - Address of the user to kick.
|
|
11
14
|
* @param signer - An ethers.js Signer instance (required).
|
|
12
|
-
* @returns The transaction
|
|
15
|
+
* @returns The transaction after it has been mined.
|
|
13
16
|
*/
|
|
14
|
-
const kick = async (chainId, user, signer) => {
|
|
17
|
+
const kick = async (chainId, gaugeSystem, user, signer) => {
|
|
15
18
|
if (!signer)
|
|
16
19
|
throw new Error("Signer is required");
|
|
17
|
-
const address = (0,
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
21
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.kick(user);
|
|
24
|
+
await tx.wait();
|
|
25
|
+
return tx;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to kick user", error);
|
|
29
|
+
}
|
|
23
30
|
};
|
|
24
31
|
exports.kick = kick;
|
|
@@ -2,23 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removeGauge = 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
|
-
* Removes a gauge from the
|
|
9
|
+
* Removes a gauge from the controller permanently. Requires GAUGE_ADMIN. Kicks the gauge's weight, unregisters it and redirects its unclaimed distributor entitlement to `recipient` in the same transaction. Not pause-gated.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
10
|
-
* @param
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressOrId - Address or config id of the gauge.
|
|
14
|
+
* @param recipient - Address that receives the gauge's unclaimed rewards.
|
|
11
15
|
* @param signer - An ethers.js Signer instance (required).
|
|
12
|
-
* @returns The transaction
|
|
16
|
+
* @returns The transaction after it has been mined.
|
|
13
17
|
*/
|
|
14
|
-
const removeGauge = async (chainId,
|
|
18
|
+
const removeGauge = async (chainId, gaugeSystem, gaugeAddressOrId, recipient, signer) => {
|
|
15
19
|
if (!signer)
|
|
16
20
|
throw new Error("Signer is required");
|
|
17
|
-
const address = (0,
|
|
18
|
-
const
|
|
19
|
-
const contract = new ethers_1.ethers.Contract(address,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
22
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
23
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
24
|
+
try {
|
|
25
|
+
const tx = await contract.removeGauge(gaugeAddress, recipient);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to remove gauge", error);
|
|
31
|
+
}
|
|
23
32
|
};
|
|
24
33
|
exports.removeGauge = removeGauge;
|
|
@@ -2,23 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.removePowerFromGauge = 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
|
-
*
|
|
9
|
+
* Releases the vote power a user still has on a removed gauge. For a paused (still active) gauge, vote 0 instead.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
10
|
-
* @param
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressOrId - Address or config id of the gauge.
|
|
11
14
|
* @param signer - An ethers.js Signer instance (required).
|
|
12
|
-
* @returns The transaction
|
|
15
|
+
* @returns The transaction after it has been mined.
|
|
13
16
|
*/
|
|
14
|
-
const removePowerFromGauge = async (chainId,
|
|
17
|
+
const removePowerFromGauge = async (chainId, gaugeSystem, gaugeAddressOrId, signer) => {
|
|
15
18
|
if (!signer)
|
|
16
19
|
throw new Error("Signer is required");
|
|
17
|
-
const address = (0,
|
|
18
|
-
const
|
|
19
|
-
const contract = new ethers_1.ethers.Contract(address,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
21
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
22
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
23
|
+
try {
|
|
24
|
+
const tx = await contract.removePowerFromGauge(gaugeAddress);
|
|
25
|
+
await tx.wait();
|
|
26
|
+
return tx;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to remove power from gauge", error);
|
|
30
|
+
}
|
|
23
31
|
};
|
|
24
32
|
exports.removePowerFromGauge = removePowerFromGauge;
|
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setBoostAmplificationEnabled = 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
|
-
* Enables or disables boost amplification for a gauge. Requires
|
|
9
|
+
* Enables or disables boost amplification for a gauge. Requires GAUGE_ADMIN.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressOrId - Address or config id of the gauge.
|
|
14
|
+
* @param enabled - True to enable amplification.
|
|
12
15
|
* @param signer - An ethers.js Signer instance (required).
|
|
13
|
-
* @returns The transaction
|
|
16
|
+
* @returns The transaction after it has been mined.
|
|
14
17
|
*/
|
|
15
|
-
const setBoostAmplificationEnabled = async (chainId,
|
|
18
|
+
const setBoostAmplificationEnabled = async (chainId, gaugeSystem, gaugeAddressOrId, enabled, signer) => {
|
|
16
19
|
if (!signer)
|
|
17
20
|
throw new Error("Signer is required");
|
|
18
|
-
const address = (0,
|
|
19
|
-
const
|
|
20
|
-
const contract = new ethers_1.ethers.Contract(address,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
22
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
23
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
24
|
+
try {
|
|
25
|
+
const tx = await contract.setBoostAmplificationEnabled(gaugeAddress, enabled);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set boost amplification", error);
|
|
31
|
+
}
|
|
24
32
|
};
|
|
25
33
|
exports.setBoostAmplificationEnabled = setBoostAmplificationEnabled;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setDistributor = 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
|
+
* Sets the GaugeRewardsDistributor wired to the controller. Requires GAUGE_ADMIN.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param distributor - Address of the new distributor.
|
|
14
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
15
|
+
* @returns The transaction after it has been mined.
|
|
16
|
+
*/
|
|
17
|
+
const setDistributor = async (chainId, gaugeSystem, distributor, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
21
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.setDistributor(distributor);
|
|
24
|
+
await tx.wait();
|
|
25
|
+
return tx;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set distributor", error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.setDistributor = setDistributor;
|
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setEmergencyGaugePause = 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
|
-
*
|
|
9
|
+
* Pauses or unpauses a single gauge. Requires EMERGENCY_ADMIN. Flips only the gauge's own switch: votes and weight are kept and its share stays in the distributor until it is unpaused. Pausing requires a registered gauge; unpausing also works for a removed one.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressOrId - Address or config id of the gauge.
|
|
14
|
+
* @param paused - True to pause, false to unpause.
|
|
12
15
|
* @param signer - An ethers.js Signer instance (required).
|
|
13
|
-
* @returns The transaction
|
|
16
|
+
* @returns The transaction after it has been mined.
|
|
14
17
|
*/
|
|
15
|
-
const setEmergencyGaugePause = async (chainId,
|
|
18
|
+
const setEmergencyGaugePause = async (chainId, gaugeSystem, gaugeAddressOrId, paused, signer) => {
|
|
16
19
|
if (!signer)
|
|
17
20
|
throw new Error("Signer is required");
|
|
18
|
-
const address = (0,
|
|
19
|
-
const
|
|
20
|
-
const contract = new ethers_1.ethers.Contract(address,
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
22
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
23
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
24
|
+
try {
|
|
25
|
+
const tx = await contract.setEmergencyGaugePause(gaugeAddress, paused);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set gauge pause", error);
|
|
31
|
+
}
|
|
24
32
|
};
|
|
25
33
|
exports.setEmergencyGaugePause = setEmergencyGaugePause;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setEmergencyGaugePauseBatch = 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
|
+
* Pauses or unpauses several gauges in one transaction. Requires EMERGENCY_ADMIN. All-or-nothing: a zero address, pausing an unregistered gauge, or a gauge already in its requested state reverts the whole batch.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressesOrIds - Addresses or config ids of the gauges.
|
|
14
|
+
* @param statuses - Requested pause state per gauge, index-aligned with the gauges.
|
|
15
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
16
|
+
* @returns The transaction after it has been mined.
|
|
17
|
+
*/
|
|
18
|
+
const setEmergencyGaugePauseBatch = async (chainId, gaugeSystem, gaugeAddressesOrIds, statuses, signer) => {
|
|
19
|
+
if (!signer)
|
|
20
|
+
throw new Error("Signer is required");
|
|
21
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
22
|
+
const gaugeAddresses = gaugeAddressesOrIds.map((g) => (0, _helpers_1.resolveGauge)(chainId, g));
|
|
23
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
24
|
+
try {
|
|
25
|
+
const tx = await contract.setEmergencyGaugePauseBatch(gaugeAddresses, statuses);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set gauge pause batch", error);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
exports.setEmergencyGaugePauseBatch = setEmergencyGaugePauseBatch;
|
|
@@ -2,23 +2,30 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setEmergencyPause = 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
|
-
*
|
|
9
|
+
* Sets the controller's global emergency pause. Requires EMERGENCY_ADMIN. Does not touch any gauge's own switch, so individually paused gauges stay paused after a global unpause.
|
|
10
|
+
*
|
|
9
11
|
* @param chainId - The chain/network to use.
|
|
10
|
-
* @param
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param paused - True to pause, false to unpause.
|
|
11
14
|
* @param signer - An ethers.js Signer instance (required).
|
|
12
|
-
* @returns The transaction
|
|
15
|
+
* @returns The transaction after it has been mined.
|
|
13
16
|
*/
|
|
14
|
-
const setEmergencyPause = async (chainId, paused, signer) => {
|
|
17
|
+
const setEmergencyPause = async (chainId, gaugeSystem, paused, signer) => {
|
|
15
18
|
if (!signer)
|
|
16
19
|
throw new Error("Signer is required");
|
|
17
|
-
const address = (0,
|
|
18
|
-
const
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
21
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.setEmergencyPause(paused);
|
|
24
|
+
await tx.wait();
|
|
25
|
+
return tx;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set emergency pause", error);
|
|
29
|
+
}
|
|
23
30
|
};
|
|
24
31
|
exports.setEmergencyPause = setEmergencyPause;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setMaxVoteBuckets = 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
|
+
* Sets the per-vote decay-bucket cap. Requires GAUGE_ADMIN. 0 is exact; 2 to 64 caps heavy multi-lock voters; 1 is rejected.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param maxBuckets - 0, or 2 to 64.
|
|
14
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
15
|
+
* @returns The transaction after it has been mined.
|
|
16
|
+
*/
|
|
17
|
+
const setMaxVoteBuckets = async (chainId, gaugeSystem, maxBuckets, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
21
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
22
|
+
try {
|
|
23
|
+
const tx = await contract.setMaxVoteBuckets(maxBuckets);
|
|
24
|
+
await tx.wait();
|
|
25
|
+
return tx;
|
|
26
|
+
}
|
|
27
|
+
catch (error) {
|
|
28
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to set max vote buckets", error);
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
exports.setMaxVoteBuckets = setMaxVoteBuckets;
|
|
@@ -2,33 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.vote = 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
|
-
*
|
|
9
|
+
* Allocates vote weight to a gauge. Reverts with GaugePaused for a non-zero vote on a paused gauge, and with EnforcedPause during a global pause.
|
|
9
10
|
*
|
|
10
11
|
* @param chainId - The chain/network to use.
|
|
11
|
-
* @param
|
|
12
|
-
* @param
|
|
13
|
-
* @param
|
|
14
|
-
* @
|
|
12
|
+
* @param gaugeSystem - Gauge system id ("raacgauges" or "rwagauges") or a GaugeController address.
|
|
13
|
+
* @param gaugeAddressOrId - Address or config id of the gauge.
|
|
14
|
+
* @param voteWeight - Vote weight in basis points.
|
|
15
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
16
|
+
* @returns The transaction after it has been mined.
|
|
15
17
|
*/
|
|
16
|
-
const vote = async (chainId,
|
|
17
|
-
if (!signer)
|
|
18
|
+
const vote = async (chainId, gaugeSystem, gaugeAddressOrId, voteWeight, signer) => {
|
|
19
|
+
if (!signer)
|
|
18
20
|
throw new Error("Signer is required");
|
|
19
|
-
|
|
21
|
+
const address = (0, _helpers_1.resolveGaugeController)(chainId, gaugeSystem);
|
|
22
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
23
|
+
const contract = new ethers_1.ethers.Contract(address, (0, artifacts_1.getABI)("gaugecontroller"), signer);
|
|
20
24
|
try {
|
|
21
|
-
const
|
|
22
|
-
const gaugeControllerABI = (0, artifacts_1.getABI)("gaugecontroller");
|
|
23
|
-
const gaugeControllerContract = new ethers_1.ethers.Contract(gaugeControllerAddress, gaugeControllerABI, signer);
|
|
24
|
-
const tx = await gaugeControllerContract.vote(gaugeAddress, voteWeight);
|
|
25
|
+
const tx = await contract.vote(gaugeAddress, voteWeight);
|
|
25
26
|
await tx.wait();
|
|
26
|
-
console.log(`Vote cast for gauge: ${gaugeAddress}`);
|
|
27
27
|
return tx;
|
|
28
28
|
}
|
|
29
29
|
catch (error) {
|
|
30
|
-
|
|
31
|
-
throw new Error(`Failed to vote: ${error.message}`);
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to vote", error);
|
|
32
31
|
}
|
|
33
32
|
};
|
|
34
33
|
exports.vote = vote;
|
|
@@ -0,0 +1,123 @@
|
|
|
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.resolveGauge = exports.lookupGauge = exports.listGauges = exports.resolveGaugeDistributor = exports.resolveGaugeController = exports.requireGaugeSystem = exports.getGaugeSystemsConfig = exports.GAUGE_SYSTEM_IDS = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const _helpers_1 = require("../_helpers");
|
|
10
|
+
exports.GAUGE_SYSTEM_IDS = ["raacgauges", "rwagauges"];
|
|
11
|
+
const isDeployed = (address) => !!address && ethers_1.ethers.isAddress(address) && address !== ethers_1.ethers.ZeroAddress;
|
|
12
|
+
/**
|
|
13
|
+
* Reads the `gauges` section of a chain config.
|
|
14
|
+
*
|
|
15
|
+
* @param chainId - The chain/network to use.
|
|
16
|
+
* @returns The configured gauge systems keyed by id; systems missing from the config are absent.
|
|
17
|
+
*/
|
|
18
|
+
const getGaugeSystemsConfig = (chainId) => {
|
|
19
|
+
const config = chains_1.default[chainId];
|
|
20
|
+
if (!config) {
|
|
21
|
+
throw new Error(`Chain configuration not found for chainId: ${chainId}`);
|
|
22
|
+
}
|
|
23
|
+
return (config.gauges ?? {});
|
|
24
|
+
};
|
|
25
|
+
exports.getGaugeSystemsConfig = getGaugeSystemsConfig;
|
|
26
|
+
/**
|
|
27
|
+
* Looks up one gauge system in the chain config.
|
|
28
|
+
*
|
|
29
|
+
* @param chainId - The chain/network to use.
|
|
30
|
+
* @param system - Gauge system id, any case.
|
|
31
|
+
* @returns The system config.
|
|
32
|
+
* @throws If the id is unknown or the chain does not configure it.
|
|
33
|
+
*/
|
|
34
|
+
const requireGaugeSystem = (chainId, system) => {
|
|
35
|
+
const id = system.toLowerCase();
|
|
36
|
+
if (!exports.GAUGE_SYSTEM_IDS.includes(id)) {
|
|
37
|
+
throw new Error(`Unknown gauge system "${system}". Expected one of: ${exports.GAUGE_SYSTEM_IDS.join(", ")}`);
|
|
38
|
+
}
|
|
39
|
+
const found = (0, exports.getGaugeSystemsConfig)(chainId)[id];
|
|
40
|
+
if (!found) {
|
|
41
|
+
throw new Error(`Gauge system "${id}" is not configured for chainId: ${chainId}`);
|
|
42
|
+
}
|
|
43
|
+
return found;
|
|
44
|
+
};
|
|
45
|
+
exports.requireGaugeSystem = requireGaugeSystem;
|
|
46
|
+
const resolveSystemContract = (chainId, ref, field, name) => {
|
|
47
|
+
if (!ref) {
|
|
48
|
+
throw new Error(`Gauge system or ${name} address is required`);
|
|
49
|
+
}
|
|
50
|
+
if (ethers_1.ethers.isAddress(ref)) {
|
|
51
|
+
return (0, _helpers_1.requireAddress)(ref, name);
|
|
52
|
+
}
|
|
53
|
+
const system = (0, exports.requireGaugeSystem)(chainId, ref);
|
|
54
|
+
if (!isDeployed(system[field])) {
|
|
55
|
+
throw new Error(`Gauge system "${system.id}" has no ${name} deployed on chainId: ${chainId}`);
|
|
56
|
+
}
|
|
57
|
+
return ethers_1.ethers.getAddress(system[field]);
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Resolves the GaugeController a controller method targets.
|
|
61
|
+
*
|
|
62
|
+
* @param chainId - The chain/network to use.
|
|
63
|
+
* @param ref - Gauge system id or a GaugeController address.
|
|
64
|
+
* @returns The checksummed GaugeController address.
|
|
65
|
+
*/
|
|
66
|
+
const resolveGaugeController = (chainId, ref) => resolveSystemContract(chainId, ref, "controller", "GaugeController");
|
|
67
|
+
exports.resolveGaugeController = resolveGaugeController;
|
|
68
|
+
/**
|
|
69
|
+
* Resolves the GaugeRewardsDistributor a distributor method targets.
|
|
70
|
+
*
|
|
71
|
+
* @param chainId - The chain/network to use.
|
|
72
|
+
* @param ref - Gauge system id or a GaugeRewardsDistributor address.
|
|
73
|
+
* @returns The checksummed GaugeRewardsDistributor address.
|
|
74
|
+
*/
|
|
75
|
+
const resolveGaugeDistributor = (chainId, ref) => resolveSystemContract(chainId, ref, "distributor", "GaugeRewardsDistributor");
|
|
76
|
+
exports.resolveGaugeDistributor = resolveGaugeDistributor;
|
|
77
|
+
/**
|
|
78
|
+
* Lists gauges from the chain config, tagged with their system.
|
|
79
|
+
*
|
|
80
|
+
* @param chainId - The chain/network to use.
|
|
81
|
+
* @param system - Optional gauge system id; all systems when omitted.
|
|
82
|
+
* @returns The configured gauges.
|
|
83
|
+
*/
|
|
84
|
+
const listGauges = (chainId, system) => {
|
|
85
|
+
const systems = system ? [(0, exports.requireGaugeSystem)(chainId, system)] : Object.values((0, exports.getGaugeSystemsConfig)(chainId));
|
|
86
|
+
return systems.flatMap((s) => (s?.gauges ?? []).map((g) => ({ ...g, system: s.id, gaugeType: s.gaugeType })));
|
|
87
|
+
};
|
|
88
|
+
exports.listGauges = listGauges;
|
|
89
|
+
/**
|
|
90
|
+
* Finds a gauge in the chain config by address or id.
|
|
91
|
+
*
|
|
92
|
+
* @param chainId - The chain/network to use.
|
|
93
|
+
* @param gaugeAddressOrId - Gauge address or config id, any case.
|
|
94
|
+
* @returns The gauge tagged with its system, or null if the config does not list it.
|
|
95
|
+
*/
|
|
96
|
+
const lookupGauge = (chainId, gaugeAddressOrId) => {
|
|
97
|
+
const target = gaugeAddressOrId.toLowerCase();
|
|
98
|
+
const field = ethers_1.ethers.isAddress(target) ? "contract" : "id";
|
|
99
|
+
return (0, exports.listGauges)(chainId).find((g) => g[field].toLowerCase() === target) ?? null;
|
|
100
|
+
};
|
|
101
|
+
exports.lookupGauge = lookupGauge;
|
|
102
|
+
/**
|
|
103
|
+
* Resolves a gauge argument to an address. Addresses pass through, so gauges missing from the
|
|
104
|
+
* config still work; ids are looked up across every gauge system.
|
|
105
|
+
*
|
|
106
|
+
* @param chainId - The chain/network to use.
|
|
107
|
+
* @param gaugeAddressOrId - Gauge address or config id.
|
|
108
|
+
* @returns The checksummed gauge address.
|
|
109
|
+
*/
|
|
110
|
+
const resolveGauge = (chainId, gaugeAddressOrId) => {
|
|
111
|
+
if (!gaugeAddressOrId) {
|
|
112
|
+
throw new Error("Gauge address or id is required");
|
|
113
|
+
}
|
|
114
|
+
if (ethers_1.ethers.isAddress(gaugeAddressOrId)) {
|
|
115
|
+
return ethers_1.ethers.getAddress(gaugeAddressOrId);
|
|
116
|
+
}
|
|
117
|
+
const gauge = (0, exports.lookupGauge)(chainId, gaugeAddressOrId);
|
|
118
|
+
if (!gauge) {
|
|
119
|
+
throw new Error(`Gauge "${gaugeAddressOrId}" not found in any gauge system for chainId: ${chainId}`);
|
|
120
|
+
}
|
|
121
|
+
return (0, _helpers_1.requireAddress)(gauge.contract, "gauge");
|
|
122
|
+
};
|
|
123
|
+
exports.resolveGauge = resolveGauge;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findGauge = void 0;
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Finds a gauge in the chain config by address or id and reports which system it belongs to.
|
|
7
|
+
* Reads the chain config only; no RPC call is made.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @param gaugeAddressOrId - Gauge address or config id, any case.
|
|
11
|
+
* @returns The gauge tagged with its system and gauge type, or null if the config does not list it.
|
|
12
|
+
*/
|
|
13
|
+
const findGauge = (chainId, gaugeAddressOrId) => (0, _helpers_1.lookupGauge)(chainId, gaugeAddressOrId);
|
|
14
|
+
exports.findGauge = findGauge;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGaugeSystem = void 0;
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Returns one gauge system from the chain config.
|
|
7
|
+
* Reads the chain config only; no RPC call is made.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @param system - Gauge system id: "raacgauges" or "rwagauges".
|
|
11
|
+
* @returns The system's label, gauge type, controller and distributor addresses and gauge list.
|
|
12
|
+
*/
|
|
13
|
+
const getGaugeSystem = (chainId, system) => (0, _helpers_1.requireGaugeSystem)(chainId, system);
|
|
14
|
+
exports.getGaugeSystem = getGaugeSystem;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGaugeSystems = void 0;
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Lists the gauge systems configured for a chain (RAAC gauges, RWA gauges).
|
|
7
|
+
* Reads the chain config only; no RPC call is made.
|
|
8
|
+
*
|
|
9
|
+
* @param chainId - The chain/network to use.
|
|
10
|
+
* @returns Each system with its id, label, gauge type, controller and distributor addresses and gauge list.
|
|
11
|
+
*/
|
|
12
|
+
const getGaugeSystems = (chainId) => Object.values((0, _helpers_1.getGaugeSystemsConfig)(chainId)).filter((s) => !!s);
|
|
13
|
+
exports.getGaugeSystems = getGaugeSystems;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getGauges = void 0;
|
|
4
|
+
const _helpers_1 = require("./_helpers");
|
|
5
|
+
/**
|
|
6
|
+
* Lists the gauges in the chain config, each tagged with the system it belongs to.
|
|
7
|
+
* Reads the chain config only; no RPC call is made. For the controller's on-chain list use
|
|
8
|
+
* `governance.controller.getRegisteredGaugeList`.
|
|
9
|
+
*
|
|
10
|
+
* @param chainId - The chain/network to use.
|
|
11
|
+
* @param system - Optional gauge system id; gauges of every system when omitted.
|
|
12
|
+
* @returns The configured gauges with their addresses.
|
|
13
|
+
*/
|
|
14
|
+
const getGauges = (chainId, system) => (0, _helpers_1.listGauges)(chainId, system);
|
|
15
|
+
exports.getGauges = getGauges;
|
|
@@ -0,0 +1,21 @@
|
|
|
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
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
// Re-exports every method in this namespace.
|
|
18
|
+
__exportStar(require("./findGauge"), exports);
|
|
19
|
+
__exportStar(require("./getGauges"), exports);
|
|
20
|
+
__exportStar(require("./getGaugeSystem"), exports);
|
|
21
|
+
__exportStar(require("./getGaugeSystems"), exports);
|
|
@@ -111,6 +111,7 @@ import { decodeErrorName, getErrorInfo, attachDecodedError, decodeErrorMessage,
|
|
|
111
111
|
import * as distributorMethods from "./contracts/governance/distributor";
|
|
112
112
|
import * as gaugeMethods from "./contracts/governance/gauge";
|
|
113
113
|
import * as controllerMethods from "./contracts/governance/gaugeController";
|
|
114
|
+
import * as gaugeSystemMethods from "./contracts/governance/gaugeSystems";
|
|
114
115
|
import { cancel as cancelProposals } from "./contracts/governance/proposals/cancel";
|
|
115
116
|
import { getQuorumNumerator as getQuorumNumeratorProposals } from "./contracts/governance/proposals/getQuorumNumerator";
|
|
116
117
|
import { getVotingPeriod as getVotingPeriodProposals } from "./contracts/governance/proposals/getVotingPeriod";
|
|
@@ -363,6 +364,7 @@ declare class RPCLibrary {
|
|
|
363
364
|
distributor: typeof distributorMethods;
|
|
364
365
|
gauge: typeof gaugeMethods;
|
|
365
366
|
controller: typeof controllerMethods;
|
|
367
|
+
gaugeSystems: typeof gaugeSystemMethods;
|
|
366
368
|
proposals: {
|
|
367
369
|
cancel: typeof cancelProposals;
|
|
368
370
|
getQuorumNumerator: typeof getQuorumNumeratorProposals;
|