@raac/rpc 1.2.0-beta.5 → 1.2.0-beta.6
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 +38 -97
- package/dist/artifacts/core/collectors/FeeCollector.sol/FeeCollector.json +2 -2
- package/dist/artifacts/core/governance/gauges/BaseGauge.sol/BaseGauge.json +155 -144
- package/dist/artifacts/core/governance/gauges/GaugeController.sol/GaugeController.json +119 -335
- package/dist/artifacts/core/governance/gauges/GaugeRewardsDistributor.sol/GaugeRewardsDistributor.json +104 -325
- package/dist/artifacts/core/governance/gauges/RAACGauge.sol/RAACGauge.json +167 -146
- package/dist/artifacts/core/governance/gauges/RWAGauge.sol/RWAGauge.json +167 -146
- package/dist/artifacts/core/governance/proposals/Governance.sol/Governance.json +2 -2
- package/dist/artifacts/core/lockers/RAACLiquidLocker.sol/RAACLiquidLocker.json +2 -2
- package/dist/artifacts/core/tokens/veRAACToken.sol/veRAACToken.json +66 -32
- package/dist/configs/chains/11155111.json +72 -16
- package/dist/configs/chains/8453.json +6 -6
- package/dist/contracts/getContractAddress.js +1 -0
- package/dist/contracts/governance/distributor/claimAll.js +25 -0
- package/dist/contracts/governance/distributor/claimForGauge.js +26 -0
- package/dist/contracts/governance/distributor/deposit.js +12 -21
- package/dist/contracts/governance/distributor/getClaimableForGauge.js +29 -0
- package/dist/contracts/governance/distributor/getClaimedAtEpoch.js +30 -0
- package/dist/contracts/governance/distributor/getDepositedAtEpoch.js +30 -0
- package/dist/contracts/governance/distributor/getGaugeController.js +28 -0
- package/dist/contracts/governance/distributor/getLastClaimedEpoch.js +29 -0
- package/dist/contracts/governance/distributor/getPeriodDuration.js +28 -0
- package/dist/contracts/governance/distributor/{getRewardTokens.js → getRewardToken.js} +10 -9
- package/dist/contracts/governance/distributor/getRewardTokenInfo.js +9 -19
- package/dist/contracts/governance/distributor/getRewardTokenStats.js +30 -0
- package/dist/contracts/governance/{gaugeController/isGauge.js → distributor/getStartEpoch.js} +10 -10
- package/dist/contracts/governance/distributor/index.js +31 -17
- package/dist/contracts/governance/distributor/setController.js +26 -0
- package/dist/contracts/governance/distributor/withdrawRemovedGaugeRewards.js +27 -0
- package/dist/contracts/governance/distributor/withdrawUnallocatedRewards.js +26 -0
- package/dist/contracts/governance/gauge/addRewardToken.js +34 -0
- package/dist/contracts/governance/gauge/claimExtraReward.js +34 -0
- package/dist/contracts/governance/gauge/claimExtraRewards.js +33 -0
- package/dist/contracts/governance/gauge/claimOnBehalfOf.js +36 -0
- package/dist/contracts/governance/gauge/claimRewardToken.js +3 -4
- package/dist/contracts/governance/gauge/claimRewardsFor.js +34 -0
- package/dist/contracts/governance/gauge/depositRewardToken.js +35 -0
- package/dist/contracts/governance/gauge/getAllPendingExtraRewards.js +36 -0
- package/dist/contracts/governance/gauge/getControllerAddress.js +34 -0
- package/dist/contracts/governance/gauge/getDecimalAdjustment.js +35 -0
- package/dist/contracts/governance/gauge/getDepositRAACOnClaim.js +34 -0
- package/dist/contracts/governance/gauge/getDistributorData.js +36 -0
- package/dist/contracts/governance/gauge/getDistributors.js +34 -0
- package/dist/contracts/governance/gauge/getEarnedReward.js +11 -19
- package/dist/contracts/governance/gauge/getExtraRewardTokens.js +34 -0
- package/dist/contracts/governance/gauge/getGaugeRewardTokenData.js +44 -0
- package/dist/contracts/governance/gauge/getPendingExtraRewards.js +36 -0
- package/dist/contracts/governance/gauge/getPendingRewards.js +11 -19
- package/dist/contracts/governance/gauge/getRaacAutolockMin.js +34 -0
- package/dist/contracts/governance/gauge/getUserRewardTokenData.js +37 -0
- package/dist/contracts/governance/gauge/getUserWeight.js +35 -0
- package/dist/contracts/governance/gauge/index.js +53 -35
- package/dist/contracts/governance/gauge/isPaused.js +34 -0
- package/dist/contracts/governance/gauge/manageDistributor.js +35 -0
- package/dist/contracts/governance/gauge/setController.js +34 -0
- package/dist/contracts/governance/gauge/setDepositRAACOnClaim.js +34 -0
- package/dist/contracts/governance/gauge/setDistributorApproval.js +35 -0
- package/dist/contracts/governance/gauge/setEmergencyPaused.js +34 -0
- package/dist/contracts/governance/gauge/setGaugeRewardDistributor.js +34 -0
- package/dist/contracts/governance/gauge/setRaacAutolockMin.js +34 -0
- package/dist/contracts/governance/gauge/updateUserRewards.js +3 -2
- package/dist/contracts/governance/gaugeController/addGauge.js +24 -0
- package/dist/contracts/governance/gaugeController/batchVote.js +25 -0
- package/dist/contracts/governance/gaugeController/forceCompleteCheckpoint.js +24 -0
- package/dist/contracts/governance/gaugeController/getConstants.js +45 -0
- package/dist/contracts/governance/gaugeController/getCurrentEpoch.js +27 -0
- package/dist/contracts/governance/gaugeController/getGauge.js +29 -0
- package/dist/contracts/governance/gaugeController/getGaugeRelativeWeight.js +29 -0
- package/dist/contracts/governance/gaugeController/getGaugeRelativeWeightView.js +30 -0
- package/dist/contracts/governance/gaugeController/getLastVoteTime.js +29 -0
- package/dist/contracts/governance/gaugeController/getNextEpoch.js +27 -0
- package/dist/contracts/governance/gaugeController/getUserGaugeVotePower.js +29 -0
- package/dist/contracts/governance/gaugeController/getVeToken.js +27 -0
- package/dist/contracts/governance/gaugeController/getVoteUserPower.js +28 -0
- package/dist/contracts/governance/gaugeController/getVoteUserSlope.js +30 -0
- package/dist/contracts/governance/gaugeController/index.js +43 -23
- package/dist/contracts/governance/gaugeController/isPaused.js +27 -0
- package/dist/contracts/governance/gaugeController/kick.js +24 -0
- package/dist/contracts/governance/gaugeController/removeGauge.js +24 -0
- package/dist/contracts/governance/gaugeController/removePowerFromGauge.js +24 -0
- package/dist/contracts/governance/gaugeController/setBoostAmplificationEnabled.js +25 -0
- package/dist/contracts/governance/gaugeController/setEmergencyGaugePause.js +25 -0
- package/dist/contracts/governance/gaugeController/setEmergencyPause.js +24 -0
- package/dist/contracts/lockers/botLocker/unlock.js +4 -1
- package/dist/contracts/lockers/maturityVault/harvest.js +3 -2
- package/dist/types/RPCLibrary.d.ts +6 -64
- package/dist/types/contracts/governance/distributor/claimAll.d.ts +11 -0
- package/dist/types/contracts/governance/distributor/claimForGauge.d.ts +12 -0
- package/dist/types/contracts/governance/distributor/deposit.d.ts +6 -7
- package/dist/types/contracts/governance/distributor/getClaimableForGauge.d.ts +11 -0
- package/dist/types/contracts/governance/distributor/getClaimedAtEpoch.d.ts +12 -0
- package/dist/types/contracts/governance/distributor/getDepositedAtEpoch.d.ts +12 -0
- package/dist/types/contracts/governance/distributor/getGaugeController.d.ts +10 -0
- package/dist/types/contracts/governance/distributor/getLastClaimedEpoch.d.ts +11 -0
- package/dist/types/contracts/governance/distributor/getPeriodDuration.d.ts +10 -0
- package/dist/types/contracts/governance/distributor/{getRewardTokens.d.ts → getRewardToken.d.ts} +3 -3
- package/dist/types/contracts/governance/distributor/getRewardTokenInfo.d.ts +8 -10
- package/dist/types/contracts/governance/distributor/getRewardTokenStats.d.ts +15 -0
- package/dist/types/contracts/governance/distributor/getStartEpoch.d.ts +10 -0
- package/dist/types/contracts/governance/distributor/index.d.ts +16 -8
- package/dist/types/contracts/governance/distributor/setController.d.ts +12 -0
- package/dist/types/contracts/governance/distributor/withdrawRemovedGaugeRewards.d.ts +13 -0
- package/dist/types/contracts/governance/distributor/withdrawUnallocatedRewards.d.ts +12 -0
- package/dist/types/contracts/governance/gauge/addRewardToken.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/claimExtraReward.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/claimExtraRewards.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/claimOnBehalfOf.d.ts +12 -0
- package/dist/types/contracts/governance/gauge/claimRewardToken.d.ts +1 -2
- package/dist/types/contracts/governance/gauge/claimRewardsFor.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/depositRewardToken.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/getAllPendingExtraRewards.d.ts +13 -0
- package/dist/types/contracts/governance/gauge/getControllerAddress.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/getDecimalAdjustment.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/getDepositRAACOnClaim.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/getDistributorData.d.ts +13 -0
- package/dist/types/contracts/governance/gauge/{getRewardTokens.d.ts → getDistributors.d.ts} +3 -5
- package/dist/types/contracts/governance/gauge/getEarnedReward.d.ts +4 -5
- package/dist/types/contracts/governance/gauge/getExtraRewardTokens.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/getGaugeRewardTokenData.d.ts +18 -0
- package/dist/types/contracts/governance/gauge/getPendingExtraRewards.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/getPendingRewards.d.ts +4 -5
- package/dist/types/contracts/governance/gauge/getRaacAutolockMin.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/getUserRewardTokenData.d.ts +17 -0
- package/dist/types/contracts/governance/gauge/getUserWeight.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/index.d.ts +38 -17
- package/dist/types/contracts/governance/gauge/isPaused.d.ts +9 -0
- package/dist/types/contracts/governance/gauge/manageDistributor.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/setController.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/setDepositRAACOnClaim.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/setDistributorApproval.d.ts +11 -0
- package/dist/types/contracts/governance/gauge/setEmergencyPaused.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/setGaugeRewardDistributor.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/setRaacAutolockMin.d.ts +10 -0
- package/dist/types/contracts/governance/gauge/updateUserRewards.d.ts +2 -1
- package/dist/types/contracts/governance/gaugeController/addGauge.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/batchVote.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeController/forceCompleteCheckpoint.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/getConstants.d.ts +18 -0
- package/dist/types/contracts/governance/gaugeController/getCurrentEpoch.d.ts +9 -0
- package/dist/types/contracts/governance/gaugeController/getGauge.d.ts +15 -0
- package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeight.d.ts +15 -0
- package/dist/types/contracts/governance/gaugeController/getGaugeRelativeWeightView.d.ts +14 -0
- package/dist/types/contracts/governance/gaugeController/getLastVoteTime.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeController/getNextEpoch.d.ts +9 -0
- package/dist/types/contracts/governance/gaugeController/getUserGaugeVotePower.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeController/getVeToken.d.ts +9 -0
- package/dist/types/contracts/governance/gaugeController/getVoteUserPower.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/getVoteUserSlope.d.ts +15 -0
- package/dist/types/contracts/governance/gaugeController/index.d.ts +28 -11
- package/dist/types/contracts/governance/gaugeController/isPaused.d.ts +9 -0
- package/dist/types/contracts/governance/gaugeController/kick.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/removeGauge.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/removePowerFromGauge.d.ts +10 -0
- package/dist/types/contracts/governance/gaugeController/setBoostAmplificationEnabled.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeController/setEmergencyGaugePause.d.ts +11 -0
- package/dist/types/contracts/governance/gaugeController/setEmergencyPause.d.ts +10 -0
- package/dist/types/contracts/lockers/botLocker/unlock.d.ts +3 -0
- package/dist/types/contracts/lockers/maturityVault/harvest.d.ts +1 -1
- package/dist/utils/contracts.js +1 -1
- package/package.json +1 -1
- package/dist/contracts/governance/distributor/getAvailableBalance.js +0 -29
- package/dist/contracts/governance/distributor/getGaugeRewardTokens.js +0 -28
- package/dist/contracts/governance/distributor/getTransferableBalance.js +0 -30
- package/dist/contracts/governance/distributor/isRewardTokenApproved.js +0 -29
- package/dist/contracts/governance/distributor/isTokenApproved.js +0 -29
- package/dist/contracts/governance/gauge/claimReward.js +0 -44
- package/dist/contracts/governance/gauge/getAllEarnedRewards.js +0 -51
- package/dist/contracts/governance/gauge/getAllPendingRewards.js +0 -41
- package/dist/contracts/governance/gauge/getRewardTokens.js +0 -41
- package/dist/contracts/governance/gauge/getUserGaugeVoteWeight.js +0 -42
- package/dist/contracts/governance/gauge/getWorkingBalance.js +0 -43
- package/dist/contracts/governance/gauge/syncRewardTokens.js +0 -51
- package/dist/contracts/governance/gaugeController/checkpoint.js +0 -33
- package/dist/contracts/governance/gaugeController/checkpointGauge.js +0 -34
- package/dist/contracts/governance/gaugeController/getUserGaugeVoteWeight.js +0 -30
- package/dist/tests/liquidLocker.test.js +0 -262
- package/dist/tests/test.js +0 -32
- package/dist/types/contracts/governance/distributor/getAvailableBalance.d.ts +0 -11
- package/dist/types/contracts/governance/distributor/getGaugeRewardTokens.d.ts +0 -11
- package/dist/types/contracts/governance/distributor/getTransferableBalance.d.ts +0 -12
- package/dist/types/contracts/governance/distributor/isRewardTokenApproved.d.ts +0 -12
- package/dist/types/contracts/governance/distributor/isTokenApproved.d.ts +0 -11
- package/dist/types/contracts/governance/gauge/claimReward.d.ts +0 -11
- package/dist/types/contracts/governance/gauge/getAllEarnedRewards.d.ts +0 -17
- package/dist/types/contracts/governance/gauge/getAllPendingRewards.d.ts +0 -19
- package/dist/types/contracts/governance/gauge/getUserGaugeVoteWeight.d.ts +0 -14
- package/dist/types/contracts/governance/gauge/getWorkingBalance.d.ts +0 -12
- package/dist/types/contracts/governance/gauge/syncRewardTokens.d.ts +0 -13
- package/dist/types/contracts/governance/gaugeController/checkpoint.d.ts +0 -11
- package/dist/types/contracts/governance/gaugeController/checkpointGauge.d.ts +0 -12
- package/dist/types/contracts/governance/gaugeController/getUserGaugeVoteWeight.d.ts +0 -12
- package/dist/types/contracts/governance/gaugeController/isGauge.d.ts +0 -11
- package/dist/types/tests/liquidLocker.test.d.ts +0 -18
- package/dist/types/tests/test.d.ts +0 -1
|
@@ -7,38 +7,30 @@ exports.getEarnedReward = void 0;
|
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
9
|
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
-
const EARNED_REWARD_ABI = "function earnedReward(address
|
|
10
|
+
const EARNED_REWARD_ABI = "function earnedReward(address user) view returns (uint256)";
|
|
11
11
|
/**
|
|
12
|
-
* Gets the
|
|
12
|
+
* Gets the total amount of main-reward-token a user has already claimed from a gauge.
|
|
13
13
|
*
|
|
14
14
|
* @param chainId - The chain/network to use.
|
|
15
|
-
* @param gaugeAddressOrId - Address of the gauge contract or
|
|
16
|
-
* @param tokenAddress - Address of the reward token.
|
|
15
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
17
16
|
* @param userAddress - Address of the user.
|
|
18
17
|
* @param provider - Optional ethers.js Provider instance.
|
|
19
|
-
* @returns The
|
|
18
|
+
* @returns The claimed reward amount (raw, base units).
|
|
20
19
|
*/
|
|
21
|
-
const getEarnedReward = async (chainId, gaugeAddressOrId,
|
|
20
|
+
const getEarnedReward = async (chainId, gaugeAddressOrId, userAddress, provider) => {
|
|
22
21
|
if (!provider) {
|
|
23
22
|
const rpc = chains_1.default[chainId].rpcs[0];
|
|
24
23
|
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
25
24
|
}
|
|
26
25
|
let gaugeAddress;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
gaugeAddress = gaugeAddressOrId;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
34
|
-
}
|
|
26
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
27
|
+
gaugeAddress = gaugeAddressOrId;
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
else {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
39
32
|
}
|
|
40
33
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, [EARNED_REWARD_ABI], provider);
|
|
41
|
-
|
|
42
|
-
return ethers_1.ethers.formatEther(earned);
|
|
34
|
+
return contract.earnedReward(userAddress);
|
|
43
35
|
};
|
|
44
36
|
exports.getEarnedReward = getEarnedReward;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getExtraRewardTokens = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets the list of extra reward token addresses registered on the gauge.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
16
|
+
*/
|
|
17
|
+
const getExtraRewardTokens = async (chainId, gaugeAddressOrId, provider) => {
|
|
18
|
+
if (!provider) {
|
|
19
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
20
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
21
|
+
}
|
|
22
|
+
let gaugeAddress;
|
|
23
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
24
|
+
gaugeAddress = gaugeAddressOrId;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
29
|
+
}
|
|
30
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
31
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
32
|
+
return contract.getExtraRewardTokens();
|
|
33
|
+
};
|
|
34
|
+
exports.getExtraRewardTokens = getExtraRewardTokens;
|
|
@@ -0,0 +1,44 @@
|
|
|
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.getGaugeRewardTokenData = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets the gauge-level reward accounting data for a specific token.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param token - Address of the reward token.
|
|
16
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
17
|
+
*/
|
|
18
|
+
const getGaugeRewardTokenData = async (chainId, gaugeAddressOrId, token, provider) => {
|
|
19
|
+
if (!provider) {
|
|
20
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
21
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
22
|
+
}
|
|
23
|
+
let gaugeAddress;
|
|
24
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
25
|
+
gaugeAddress = gaugeAddressOrId;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
32
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
33
|
+
const [isActive, decimals, rate, integral, lastUpdateTime, distributed, leftoverRewards,] = await contract.getGaugeRewardTokenData(token);
|
|
34
|
+
return {
|
|
35
|
+
isActive,
|
|
36
|
+
decimals,
|
|
37
|
+
rate,
|
|
38
|
+
integral,
|
|
39
|
+
lastUpdateTime,
|
|
40
|
+
distributed,
|
|
41
|
+
leftoverRewards,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
exports.getGaugeRewardTokenData = getGaugeRewardTokenData;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getPendingExtraRewards = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets the pending extra rewards for a user for a specific token.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param token - Address of the reward token.
|
|
16
|
+
* @param user - Address of the user.
|
|
17
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
18
|
+
*/
|
|
19
|
+
const getPendingExtraRewards = async (chainId, gaugeAddressOrId, token, user, provider) => {
|
|
20
|
+
if (!provider) {
|
|
21
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
22
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
23
|
+
}
|
|
24
|
+
let gaugeAddress;
|
|
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
|
+
}
|
|
32
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
33
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
34
|
+
return contract.pendingExtraRewards(token, user);
|
|
35
|
+
};
|
|
36
|
+
exports.getPendingExtraRewards = getPendingExtraRewards;
|
|
@@ -7,38 +7,30 @@ exports.getPendingRewards = void 0;
|
|
|
7
7
|
const ethers_1 = require("ethers");
|
|
8
8
|
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
9
|
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
-
const PENDING_REWARDS_ABI = "function pendingRewards(address
|
|
10
|
+
const PENDING_REWARDS_ABI = "function pendingRewards(address account) view returns (uint256)";
|
|
11
11
|
/**
|
|
12
|
-
* Gets the pending
|
|
12
|
+
* Gets the pending (unclaimed) main-reward-token amount for a user on a gauge.
|
|
13
13
|
*
|
|
14
14
|
* @param chainId - The chain/network to use.
|
|
15
|
-
* @param gaugeAddressOrId - Address of the gauge contract or
|
|
16
|
-
* @param tokenAddress - Address of the reward token.
|
|
15
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
17
16
|
* @param accountAddress - Address of the user.
|
|
18
17
|
* @param provider - Optional ethers.js Provider instance.
|
|
19
|
-
* @returns The
|
|
18
|
+
* @returns The pending reward amount (raw, base units).
|
|
20
19
|
*/
|
|
21
|
-
const getPendingRewards = async (chainId, gaugeAddressOrId,
|
|
20
|
+
const getPendingRewards = async (chainId, gaugeAddressOrId, accountAddress, provider) => {
|
|
22
21
|
if (!provider) {
|
|
23
22
|
const rpc = chains_1.default[chainId].rpcs[0];
|
|
24
23
|
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
25
24
|
}
|
|
26
25
|
let gaugeAddress;
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
gaugeAddress = gaugeAddressOrId;
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
// @ts-ignore
|
|
33
|
-
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
34
|
-
}
|
|
26
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
27
|
+
gaugeAddress = gaugeAddressOrId;
|
|
35
28
|
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
else {
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
39
32
|
}
|
|
40
33
|
const contract = new ethers_1.ethers.Contract(gaugeAddress, [PENDING_REWARDS_ABI], provider);
|
|
41
|
-
|
|
42
|
-
return ethers_1.ethers.formatEther(pending);
|
|
34
|
+
return contract.pendingRewards(accountAddress);
|
|
43
35
|
};
|
|
44
36
|
exports.getPendingRewards = getPendingRewards;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getRaacAutolockMin = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets the minimum RAAC amount required to trigger an autolock on claim.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
16
|
+
*/
|
|
17
|
+
const getRaacAutolockMin = async (chainId, gaugeAddressOrId, provider) => {
|
|
18
|
+
if (!provider) {
|
|
19
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
20
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
21
|
+
}
|
|
22
|
+
let gaugeAddress;
|
|
23
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
24
|
+
gaugeAddress = gaugeAddressOrId;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
29
|
+
}
|
|
30
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
31
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
32
|
+
return contract.raacAutolockMin();
|
|
33
|
+
};
|
|
34
|
+
exports.getRaacAutolockMin = getRaacAutolockMin;
|
|
@@ -0,0 +1,37 @@
|
|
|
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.getUserRewardTokenData = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets a user's reward accounting data for a specific token.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param token - Address of the reward token.
|
|
16
|
+
* @param user - Address of the user.
|
|
17
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
18
|
+
*/
|
|
19
|
+
const getUserRewardTokenData = async (chainId, gaugeAddressOrId, token, user, provider) => {
|
|
20
|
+
if (!provider) {
|
|
21
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
22
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
23
|
+
}
|
|
24
|
+
let gaugeAddress;
|
|
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
|
+
}
|
|
32
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
33
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
34
|
+
const [integral, lastGaugeIntegral, claimable, claimed, lastUpdate] = await contract.getUserRewardTokenData(token, user);
|
|
35
|
+
return { integral, lastGaugeIntegral, claimable, claimed, lastUpdate };
|
|
36
|
+
};
|
|
37
|
+
exports.getUserRewardTokenData = getUserRewardTokenData;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getUserWeight = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Gets the gauge vote weight for a given account.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param account - Address of the user.
|
|
16
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
17
|
+
*/
|
|
18
|
+
const getUserWeight = async (chainId, gaugeAddressOrId, account, provider) => {
|
|
19
|
+
if (!provider) {
|
|
20
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
21
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
22
|
+
}
|
|
23
|
+
let gaugeAddress;
|
|
24
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
25
|
+
gaugeAddress = gaugeAddressOrId;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
// @ts-ignore
|
|
29
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
30
|
+
}
|
|
31
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
32
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
33
|
+
return contract.getUserWeight(account);
|
|
34
|
+
};
|
|
35
|
+
exports.getUserWeight = getUserWeight;
|
|
@@ -1,37 +1,55 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
2
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
17
|
+
// Auto-generated barrel: re-exports every method in this namespace.
|
|
18
|
+
__exportStar(require("./addRewardToken"), exports);
|
|
19
|
+
__exportStar(require("./claimExtraReward"), exports);
|
|
20
|
+
__exportStar(require("./claimExtraRewards"), exports);
|
|
21
|
+
__exportStar(require("./claimOnBehalfOf"), exports);
|
|
22
|
+
__exportStar(require("./claimRewardsFor"), exports);
|
|
23
|
+
__exportStar(require("./claimRewardToken"), exports);
|
|
24
|
+
__exportStar(require("./depositRewardToken"), exports);
|
|
25
|
+
__exportStar(require("./getAllPendingExtraRewards"), exports);
|
|
26
|
+
__exportStar(require("./getBalanceOf"), exports);
|
|
27
|
+
__exportStar(require("./getControllerAddress"), exports);
|
|
28
|
+
__exportStar(require("./getDecimalAdjustment"), exports);
|
|
29
|
+
__exportStar(require("./getDepositRAACOnClaim"), exports);
|
|
30
|
+
__exportStar(require("./getDistributorData"), exports);
|
|
31
|
+
__exportStar(require("./getDistributors"), exports);
|
|
32
|
+
__exportStar(require("./getEarnedReward"), exports);
|
|
33
|
+
__exportStar(require("./getExtraRewardTokens"), exports);
|
|
34
|
+
__exportStar(require("./getGaugeRewardTokenData"), exports);
|
|
35
|
+
__exportStar(require("./getPendingExtraRewards"), exports);
|
|
36
|
+
__exportStar(require("./getPendingRewards"), exports);
|
|
37
|
+
__exportStar(require("./getPeriodBoundaries"), exports);
|
|
38
|
+
__exportStar(require("./getPeriodDuration"), exports);
|
|
39
|
+
__exportStar(require("./getRaacAutolockMin"), exports);
|
|
40
|
+
__exportStar(require("./getRawBalanceOf"), exports);
|
|
41
|
+
__exportStar(require("./getRawTotalSupply"), exports);
|
|
42
|
+
__exportStar(require("./getTotalSupply"), exports);
|
|
43
|
+
__exportStar(require("./getUserRewardTokenData"), exports);
|
|
44
|
+
__exportStar(require("./getUserWeight"), exports);
|
|
45
|
+
__exportStar(require("./isPaused"), exports);
|
|
46
|
+
__exportStar(require("./manageDistributor"), exports);
|
|
47
|
+
__exportStar(require("./setController"), exports);
|
|
48
|
+
__exportStar(require("./setDepositRAACOnClaim"), exports);
|
|
49
|
+
__exportStar(require("./setDistributorApproval"), exports);
|
|
50
|
+
__exportStar(require("./setEmergencyPaused"), exports);
|
|
51
|
+
__exportStar(require("./setGaugeRewardDistributor"), exports);
|
|
52
|
+
__exportStar(require("./setRaacAutolockMin"), exports);
|
|
53
|
+
__exportStar(require("./stake"), exports);
|
|
54
|
+
__exportStar(require("./updateUserRewards"), exports);
|
|
55
|
+
__exportStar(require("./withdraw"), exports);
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.isPaused = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const chains_1 = __importDefault(require("../../../configs/chains"));
|
|
9
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
10
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether the gauge is currently paused.
|
|
13
|
+
* @param chainId - The chain/network to use.
|
|
14
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
15
|
+
* @param provider - Optional ethers.js Provider instance.
|
|
16
|
+
*/
|
|
17
|
+
const isPaused = async (chainId, gaugeAddressOrId, provider) => {
|
|
18
|
+
if (!provider) {
|
|
19
|
+
const rpc = chains_1.default[chainId].rpcs[0];
|
|
20
|
+
provider = new ethers_1.ethers.JsonRpcProvider(rpc);
|
|
21
|
+
}
|
|
22
|
+
let gaugeAddress;
|
|
23
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
24
|
+
gaugeAddress = gaugeAddressOrId;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// @ts-ignore
|
|
28
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
29
|
+
}
|
|
30
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
31
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, provider);
|
|
32
|
+
return contract.paused();
|
|
33
|
+
};
|
|
34
|
+
exports.isPaused = isPaused;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.manageDistributor = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
+
/**
|
|
11
|
+
* Adds or removes a distributor on the gauge (requires GAUGE_ADMIN).
|
|
12
|
+
* @param chainId - The chain/network to use.
|
|
13
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
14
|
+
* @param distributor - Address of the distributor to manage.
|
|
15
|
+
* @param shouldAdd - True to add, false to remove.
|
|
16
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
17
|
+
*/
|
|
18
|
+
const manageDistributor = async (chainId, gaugeAddressOrId, distributor, shouldAdd, signer) => {
|
|
19
|
+
if (!signer)
|
|
20
|
+
throw new Error("Signer is required");
|
|
21
|
+
let gaugeAddress;
|
|
22
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
23
|
+
gaugeAddress = gaugeAddressOrId;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
30
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
31
|
+
const tx = await contract.manageDistributor(distributor, shouldAdd);
|
|
32
|
+
await tx.wait();
|
|
33
|
+
return tx;
|
|
34
|
+
};
|
|
35
|
+
exports.manageDistributor = manageDistributor;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setController = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
+
/**
|
|
11
|
+
* Sets the gauge controller address (requires GAUGE_ADMIN).
|
|
12
|
+
* @param chainId - The chain/network to use.
|
|
13
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
14
|
+
* @param controller - Address of the new controller.
|
|
15
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
16
|
+
*/
|
|
17
|
+
const setController = async (chainId, gaugeAddressOrId, controller, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
let gaugeAddress;
|
|
21
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
22
|
+
gaugeAddress = gaugeAddressOrId;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
|
+
const tx = await contract.setController(controller);
|
|
31
|
+
await tx.wait();
|
|
32
|
+
return tx;
|
|
33
|
+
};
|
|
34
|
+
exports.setController = setController;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setDepositRAACOnClaim = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
+
/**
|
|
11
|
+
* Toggles whether claimed RAAC is auto-deposited on claim (requires DEFAULT_ADMIN_ROLE).
|
|
12
|
+
* @param chainId - The chain/network to use.
|
|
13
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
14
|
+
* @param value - New value for the deposit-on-claim flag.
|
|
15
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
16
|
+
*/
|
|
17
|
+
const setDepositRAACOnClaim = async (chainId, gaugeAddressOrId, value, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
let gaugeAddress;
|
|
21
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
22
|
+
gaugeAddress = gaugeAddressOrId;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
|
+
const tx = await contract.setDepositRAACOnClaim(value);
|
|
31
|
+
await tx.wait();
|
|
32
|
+
return tx;
|
|
33
|
+
};
|
|
34
|
+
exports.setDepositRAACOnClaim = setDepositRAACOnClaim;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setDistributorApproval = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
+
/**
|
|
11
|
+
* Sets the approval flag for a distributor on the gauge (requires GAUGE_ADMIN).
|
|
12
|
+
* @param chainId - The chain/network to use.
|
|
13
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
14
|
+
* @param distributor - Address of the distributor.
|
|
15
|
+
* @param isApproved - Whether the distributor should be approved.
|
|
16
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
17
|
+
*/
|
|
18
|
+
const setDistributorApproval = async (chainId, gaugeAddressOrId, distributor, isApproved, signer) => {
|
|
19
|
+
if (!signer)
|
|
20
|
+
throw new Error("Signer is required");
|
|
21
|
+
let gaugeAddress;
|
|
22
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
23
|
+
gaugeAddress = gaugeAddressOrId;
|
|
24
|
+
}
|
|
25
|
+
else {
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
28
|
+
}
|
|
29
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
30
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
31
|
+
const tx = await contract.setDistributorApproval(distributor, isApproved);
|
|
32
|
+
await tx.wait();
|
|
33
|
+
return tx;
|
|
34
|
+
};
|
|
35
|
+
exports.setDistributorApproval = setDistributorApproval;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.setEmergencyPaused = void 0;
|
|
7
|
+
const ethers_1 = require("ethers");
|
|
8
|
+
const artifacts_1 = require("../../../utils/artifacts");
|
|
9
|
+
const getContractAddress_1 = __importDefault(require("../../getContractAddress"));
|
|
10
|
+
/**
|
|
11
|
+
* Sets the emergency paused state of the gauge (requires CONTROLLER_ROLE).
|
|
12
|
+
* @param chainId - The chain/network to use.
|
|
13
|
+
* @param gaugeAddressOrId - Address of the gauge contract or its config ID.
|
|
14
|
+
* @param paused - True to pause, false to unpause.
|
|
15
|
+
* @param signer - An ethers.js Signer instance (required).
|
|
16
|
+
*/
|
|
17
|
+
const setEmergencyPaused = async (chainId, gaugeAddressOrId, paused, signer) => {
|
|
18
|
+
if (!signer)
|
|
19
|
+
throw new Error("Signer is required");
|
|
20
|
+
let gaugeAddress;
|
|
21
|
+
if ((0, ethers_1.isAddress)(gaugeAddressOrId)) {
|
|
22
|
+
gaugeAddress = gaugeAddressOrId;
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
// @ts-ignore
|
|
26
|
+
gaugeAddress = (0, getContractAddress_1.default)(chainId, gaugeAddressOrId.toLowerCase());
|
|
27
|
+
}
|
|
28
|
+
const abi = (0, artifacts_1.getABI)("basegauge");
|
|
29
|
+
const contract = new ethers_1.ethers.Contract(gaugeAddress, abi, signer);
|
|
30
|
+
const tx = await contract.setEmergencyPaused(paused);
|
|
31
|
+
await tx.wait();
|
|
32
|
+
return tx;
|
|
33
|
+
};
|
|
34
|
+
exports.setEmergencyPaused = setEmergencyPaused;
|