@raac/rpc 1.2.0-beta.10 → 1.2.0-beta.11
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 +56 -71
- 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
|
@@ -7,7 +7,7 @@ exports.getUserRewardTokenData = void 0;
|
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
9
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
-
const
|
|
10
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
11
11
|
/**
|
|
12
12
|
* Gets a user's reward accounting data for a specific token.
|
|
13
13
|
* @param chainId - The chain/network to use.
|
|
@@ -21,14 +21,7 @@ const getUserRewardTokenData = async (chainId, gaugeAddressOrId, token, user, pr
|
|
|
21
21
|
const rpc = chains_1.default[chainId].rpcs[0];
|
|
22
22
|
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
23
23
|
}
|
|
24
|
-
|
|
25
|
-
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
26
|
-
gaugeAddress = gaugeAddressOrId;
|
|
27
|
-
}
|
|
28
|
-
else {
|
|
29
|
-
// @ts-ignore
|
|
30
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
31
|
-
}
|
|
24
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
32
25
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
33
26
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
34
27
|
const [integral, lastGaugeIntegral, claimable, claimed, lastUpdate] = await contract.getUserRewardTokenData(token, user);
|
|
@@ -7,7 +7,7 @@ exports.getUserWeight = void 0;
|
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
9
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
-
const
|
|
10
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
11
11
|
/**
|
|
12
12
|
* Gets the gauge vote weight for a given account.
|
|
13
13
|
* @param chainId - The chain/network to use.
|
|
@@ -20,14 +20,7 @@ const getUserWeight = async (chainId, gaugeAddressOrId, account, provider) => {
|
|
|
20
20
|
const rpc = chains_1.default[chainId].rpcs[0];
|
|
21
21
|
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
22
22
|
}
|
|
23
|
-
|
|
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
|
-
}
|
|
23
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
31
24
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
32
25
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
33
26
|
return contract.getUserWeight(account);
|
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
// Auto-generated barrel: re-exports every method in this namespace.
|
|
18
18
|
__exportStar(require("./addRewardToken"), exports);
|
|
19
|
+
__exportStar(require("./approveGaugeToken"), exports);
|
|
19
20
|
__exportStar(require("./claimExtraReward"), exports);
|
|
20
21
|
__exportStar(require("./claimExtraRewards"), exports);
|
|
21
22
|
__exportStar(require("./claimOnBehalfOf"), exports);
|
|
@@ -23,15 +24,19 @@ __exportStar(require("./claimRewardsFor"), exports);
|
|
|
23
24
|
__exportStar(require("./claimRewardToken"), exports);
|
|
24
25
|
__exportStar(require("./depositRewardToken"), exports);
|
|
25
26
|
__exportStar(require("./getAllPendingExtraRewards"), exports);
|
|
27
|
+
__exportStar(require("./getApy"), exports);
|
|
26
28
|
__exportStar(require("./getBalanceOf"), exports);
|
|
27
29
|
__exportStar(require("./getControllerAddress"), exports);
|
|
28
30
|
__exportStar(require("./getDecimalAdjustment"), exports);
|
|
29
31
|
__exportStar(require("./getDepositRAACOnClaim"), exports);
|
|
30
32
|
__exportStar(require("./getDistributorData"), exports);
|
|
31
33
|
__exportStar(require("./getDistributors"), exports);
|
|
34
|
+
__exportStar(require("./getEarnedExtraReward"), exports);
|
|
32
35
|
__exportStar(require("./getEarnedReward"), exports);
|
|
33
36
|
__exportStar(require("./getExtraRewardTokens"), exports);
|
|
37
|
+
__exportStar(require("./getGaugeData"), exports);
|
|
34
38
|
__exportStar(require("./getGaugeRewardTokenData"), exports);
|
|
39
|
+
__exportStar(require("./getPauseStatus"), exports);
|
|
35
40
|
__exportStar(require("./getPendingExtraRewards"), exports);
|
|
36
41
|
__exportStar(require("./getPendingRewards"), exports);
|
|
37
42
|
__exportStar(require("./getPeriodBoundaries"), exports);
|
|
@@ -39,18 +44,23 @@ __exportStar(require("./getPeriodDuration"), exports);
|
|
|
39
44
|
__exportStar(require("./getRaacAutolockMin"), exports);
|
|
40
45
|
__exportStar(require("./getRawBalanceOf"), exports);
|
|
41
46
|
__exportStar(require("./getRawTotalSupply"), exports);
|
|
47
|
+
__exportStar(require("./getRewardTokens"), exports);
|
|
42
48
|
__exportStar(require("./getTotalSupply"), exports);
|
|
49
|
+
__exportStar(require("./getUserApy"), exports);
|
|
43
50
|
__exportStar(require("./getUserClaimableRewards"), exports);
|
|
51
|
+
__exportStar(require("./getUserGaugeState"), exports);
|
|
44
52
|
__exportStar(require("./getUserRewardTokenData"), exports);
|
|
45
53
|
__exportStar(require("./getUserWeight"), exports);
|
|
46
54
|
__exportStar(require("./isPaused"), exports);
|
|
47
55
|
__exportStar(require("./manageDistributor"), exports);
|
|
56
|
+
__exportStar(require("./pullRewardsFromDistributor"), exports);
|
|
48
57
|
__exportStar(require("./setController"), exports);
|
|
49
58
|
__exportStar(require("./setDepositRAACOnClaim"), exports);
|
|
50
|
-
__exportStar(require("./setDistributorApproval"), exports);
|
|
51
59
|
__exportStar(require("./setEmergencyPaused"), exports);
|
|
52
60
|
__exportStar(require("./setGaugeRewardDistributor"), exports);
|
|
53
61
|
__exportStar(require("./setRaacAutolockMin"), exports);
|
|
54
62
|
__exportStar(require("./stake"), exports);
|
|
63
|
+
__exportStar(require("./unwrapStakingToken"), exports);
|
|
55
64
|
__exportStar(require("./updateUserRewards"), exports);
|
|
56
65
|
__exportStar(require("./withdraw"), exports);
|
|
66
|
+
__exportStar(require("./wrapStakingToken"), exports);
|
|
@@ -7,9 +7,9 @@ exports.isPaused = void 0;
|
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
9
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
-
const
|
|
10
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
11
11
|
/**
|
|
12
|
-
* Returns
|
|
12
|
+
* Returns the gauge's own emergency pause switch. Does not reflect the controller's global pause; use `getPauseStatus` for both.
|
|
13
13
|
* @param chainId - The chain/network to use.
|
|
14
14
|
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
15
|
* @param provider - Optional ethers.js Provider instance.
|
|
@@ -19,16 +19,9 @@ const isPaused = async (chainId, gaugeAddressOrId, provider) => {
|
|
|
19
19
|
const rpc = chains_1.default[chainId].rpcs[0];
|
|
20
20
|
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
21
21
|
}
|
|
22
|
-
|
|
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
|
-
}
|
|
22
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
30
23
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
31
24
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
32
|
-
return contract.
|
|
25
|
+
return contract.isPaused();
|
|
33
26
|
};
|
|
34
27
|
exports.isPaused = isPaused;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.manageDistributor = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Adds or removes a distributor on the gauge (requires GAUGE_ADMIN).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -18,14 +15,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
18
15
|
const manageDistributor = async (chainId, gaugeAddressOrId, distributor, shouldAdd, signer) => {
|
|
19
16
|
if (!signer)
|
|
20
17
|
throw new Error("Signer is required");
|
|
21
|
-
|
|
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
|
-
}
|
|
18
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
29
19
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
30
20
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
31
21
|
const tx = await contract.manageDistributor(distributor, shouldAdd);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.pullRewardsFromDistributor = 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
|
+
* Pulls a gauge's accrued share from its rewards distributor into the gauge's reward rate. Callable by anyone. Reverts while the gauge or its controller is paused; the share stays in the distributor and the first pull after the pause walks every missed epoch.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
13
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
14
|
+
* @returns The transaction after it has been mined.
|
|
15
|
+
*/
|
|
16
|
+
const pullRewardsFromDistributor = async (chainId, gaugeAddressOrId, signer) => {
|
|
17
|
+
if (!signer)
|
|
18
|
+
throw new Error("Signer is required");
|
|
19
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
20
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, (0, artifacts_1.getABI)("basegauge"), signer);
|
|
21
|
+
try {
|
|
22
|
+
const tx = await contract.pullRewardsFromDistributor();
|
|
23
|
+
await tx.wait();
|
|
24
|
+
return tx;
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to pull rewards from distributor", error);
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
exports.pullRewardsFromDistributor = pullRewardsFromDistributor;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.setController = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Sets the gauge controller address (requires GAUGE_ADMIN).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -17,14 +14,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
17
14
|
const setController = async (chainId, gaugeAddressOrId, controller, signer) => {
|
|
18
15
|
if (!signer)
|
|
19
16
|
throw new Error("Signer is required");
|
|
20
|
-
|
|
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
|
-
}
|
|
17
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
28
18
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
19
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
20
|
const tx = await contract.setController(controller);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.setDepositRAACOnClaim = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Toggles whether claimed RAAC is auto-deposited on claim (requires DEFAULT_ADMIN_ROLE).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -17,14 +14,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
17
14
|
const setDepositRAACOnClaim = async (chainId, gaugeAddressOrId, value, signer) => {
|
|
18
15
|
if (!signer)
|
|
19
16
|
throw new Error("Signer is required");
|
|
20
|
-
|
|
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
|
-
}
|
|
17
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
28
18
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
19
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
20
|
const tx = await contract.setDepositRAACOnClaim(value);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.setEmergencyPaused = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Sets the emergency paused state of the gauge (requires CONTROLLER_ROLE).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -17,14 +14,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
17
14
|
const setEmergencyPaused = async (chainId, gaugeAddressOrId, paused, signer) => {
|
|
18
15
|
if (!signer)
|
|
19
16
|
throw new Error("Signer is required");
|
|
20
|
-
|
|
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
|
-
}
|
|
17
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
28
18
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
19
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
20
|
const tx = await contract.setEmergencyPaused(paused);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.setGaugeRewardDistributor = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Sets the gauge reward distributor address (requires DEFAULT_ADMIN_ROLE).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -17,14 +14,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
17
14
|
const setGaugeRewardDistributor = async (chainId, gaugeAddressOrId, rewardDistributor, signer) => {
|
|
18
15
|
if (!signer)
|
|
19
16
|
throw new Error("Signer is required");
|
|
20
|
-
|
|
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
|
-
}
|
|
17
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
28
18
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
19
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
20
|
const tx = await contract.setGaugeRewardDistributor(rewardDistributor);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.setRaacAutolockMin = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Sets the minimum RAAC amount required to trigger an autolock on claim (requires DEFAULT_ADMIN_ROLE).
|
|
12
9
|
* @param chainId - The chain/network to use.
|
|
@@ -17,14 +14,7 @@ const getContractAddress_1 = __importDefault(require("../../getContractAddress")
|
|
|
17
14
|
const setRaacAutolockMin = async (chainId, gaugeAddressOrId, amount, signer) => {
|
|
18
15
|
if (!signer)
|
|
19
16
|
throw new Error("Signer is required");
|
|
20
|
-
|
|
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
|
-
}
|
|
17
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
28
18
|
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
19
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
20
|
const tx = await contract.setRaacAutolockMin(amount);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.stake = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Stakes tokens in a gauge.
|
|
12
9
|
* Will also claim all pending rewards and update working balance before staking.
|
|
@@ -21,20 +18,7 @@ const stake = async (chainId, gaugeAddressOrId, amount, signer) => {
|
|
|
21
18
|
if (!signer) {
|
|
22
19
|
throw new Error("Signer is required");
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
27
|
-
gaugeAddress = gaugeAddressOrId;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error("Error staking:", error);
|
|
36
|
-
throw new Error(`Failed to stake in gauge ${gaugeAddress}: ${error.message}`);
|
|
37
|
-
}
|
|
21
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
38
22
|
try {
|
|
39
23
|
const gaugeABI = (0, artifacts_1.getABI)("basegauge");
|
|
40
24
|
const gaugeContract = new ethers_1.ethers.Contract(gaugeAddress, gaugeABI, signer);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.unwrapStakingToken = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
6
|
+
const _tokens_1 = require("./_tokens");
|
|
7
|
+
/**
|
|
8
|
+
* Unwraps a wrapped gauge's staking token back into its underlying (ERC4626 `redeem`), sending it to the signer.
|
|
9
|
+
*
|
|
10
|
+
* @param chainId - The chain/network to use.
|
|
11
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
12
|
+
* @param shares - Staking token to unwrap, base units.
|
|
13
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
14
|
+
* @returns The mined transaction.
|
|
15
|
+
*/
|
|
16
|
+
const unwrapStakingToken = async (chainId, gaugeAddressOrId, shares, signer) => {
|
|
17
|
+
if (!signer)
|
|
18
|
+
throw new Error("Signer is required");
|
|
19
|
+
const gauge = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
20
|
+
const { stakingToken, underlying } = await (0, _tokens_1.getGaugeTokens)(gauge, signer);
|
|
21
|
+
if (!underlying)
|
|
22
|
+
throw new Error(`Gauge ${gauge} does not take a wrapped token`);
|
|
23
|
+
const owner = await signer.getAddress();
|
|
24
|
+
const tx = await new ethers_1.ethers.Contract(stakingToken, _tokens_1.ERC4626_ABI, signer).redeem(shares, owner, owner);
|
|
25
|
+
await tx.wait();
|
|
26
|
+
return tx;
|
|
27
|
+
};
|
|
28
|
+
exports.unwrapStakingToken = unwrapStakingToken;
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.updateUserRewards = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Triggers an update of the user's reward state.
|
|
12
9
|
* This can be called to force rewards to accrue without claiming.
|
|
@@ -21,20 +18,7 @@ const updateUserRewards = async (chainId, gaugeAddressOrId, user, signer) => {
|
|
|
21
18
|
if (!signer) {
|
|
22
19
|
throw new Error("Signer is required");
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
27
|
-
gaugeAddress = gaugeAddressOrId;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error("Error updating user rewards:", error);
|
|
36
|
-
throw new Error(`Failed to update user rewards for gauge ${gaugeAddress}: ${error.message}`);
|
|
37
|
-
}
|
|
21
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
38
22
|
try {
|
|
39
23
|
const gaugeABI = (0, artifacts_1.getABI)("basegauge");
|
|
40
24
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, gaugeABI, signer);
|
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.withdraw = void 0;
|
|
7
4
|
const ethers_1 = require("ethers");
|
|
8
5
|
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
-
const
|
|
6
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
10
7
|
/**
|
|
11
8
|
* Withdraws staked tokens from a gauge.
|
|
12
9
|
* Will also claim all pending rewards and update working balance before withdrawing.
|
|
@@ -21,20 +18,7 @@ const withdraw = async (chainId, gaugeAddressOrId, amount, signer) => {
|
|
|
21
18
|
if (!signer) {
|
|
22
19
|
throw new Error("Signer is required");
|
|
23
20
|
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
27
|
-
gaugeAddress = gaugeAddressOrId;
|
|
28
|
-
}
|
|
29
|
-
else {
|
|
30
|
-
// @ts-ignore
|
|
31
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
catch (error) {
|
|
35
|
-
console.error("Error withdrawing:", error);
|
|
36
|
-
throw new Error(`Failed to withdraw from gauge ${gaugeAddress}: ${error.message}`);
|
|
37
|
-
}
|
|
21
|
+
const gaugeAddress = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
38
22
|
try {
|
|
39
23
|
const gaugeABI = (0, artifacts_1.getABI)("basegauge");
|
|
40
24
|
const gaugeContract = new ethers_1.ethers.Contract(gaugeAddress, gaugeABI, signer);
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.wrapStakingToken = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
const _helpers_1 = require("../gaugeSystems/_helpers");
|
|
6
|
+
const _tokens_1 = require("./_tokens");
|
|
7
|
+
/**
|
|
8
|
+
* Wraps the underlying of a wrapped gauge into its staking token (ERC4626 `deposit`), minting the shares to the signer.
|
|
9
|
+
* The underlying must be approved to the wrapper first, see `approveGaugeToken`.
|
|
10
|
+
*
|
|
11
|
+
* @param chainId - The chain/network to use.
|
|
12
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
13
|
+
* @param assets - Underlying to wrap, base units.
|
|
14
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
15
|
+
* @returns The mined transaction.
|
|
16
|
+
*/
|
|
17
|
+
const wrapStakingToken = async (chainId, gaugeAddressOrId, assets, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
const gauge = (0, _helpers_1.resolveGauge)(chainId, gaugeAddressOrId);
|
|
21
|
+
const { stakingToken, underlying } = await (0, _tokens_1.getGaugeTokens)(gauge, signer);
|
|
22
|
+
if (!underlying)
|
|
23
|
+
throw new Error(`Gauge ${gauge} does not take a wrapped token`);
|
|
24
|
+
const tx = await new ethers_1.ethers.Contract(stakingToken, _tokens_1.ERC4626_ABI, signer).deposit(assets, await signer.getAddress());
|
|
25
|
+
await tx.wait();
|
|
26
|
+
return tx;
|
|
27
|
+
};
|
|
28
|
+
exports.wrapStakingToken = wrapStakingToken;
|
|
@@ -2,23 +2,31 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addGauge = 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
|
+
* Registers a gauge on the controller. Requires GAUGE_ADMIN. The gauge must belong to this system (RAACGauge on the RAAC controller, RWAGauge on the RWA controller).
|
|
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 addGauge = async (chainId,
|
|
17
|
+
const addGauge = 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.addGauge(gaugeAddress);
|
|
25
|
+
await tx.wait();
|
|
26
|
+
return tx;
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to add gauge", error);
|
|
30
|
+
}
|
|
23
31
|
};
|
|
24
32
|
exports.addGauge = addGauge;
|
|
@@ -2,24 +2,32 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.batchVote = 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
|
+
* Votes on several gauges in one transaction.
|
|
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 gaugeAddressesOrIds - Addresses or config ids of the gauges.
|
|
14
|
+
* @param voteWeights - Vote weight per gauge in basis points, index-aligned with the gauges.
|
|
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 batchVote = async (chainId,
|
|
18
|
+
const batchVote = async (chainId, gaugeSystem, gaugeAddressesOrIds, voteWeights, 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 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.batchVote(gaugeAddresses, voteWeights);
|
|
26
|
+
await tx.wait();
|
|
27
|
+
return tx;
|
|
28
|
+
}
|
|
29
|
+
catch (error) {
|
|
30
|
+
throw (0, _helpers_2.toGovernanceTxError)("Failed to batch vote", error);
|
|
31
|
+
}
|
|
24
32
|
};
|
|
25
33
|
exports.batchVote = batchVote;
|