Skip to content

Commit 8c5c461

Browse files
authored
Merge pull request #740 from ethereum/dev
Deploy `dev` into `master`
2 parents eb42a88 + c1291b6 commit 8c5c461

File tree

2 files changed

+36
-14
lines changed

2 files changed

+36
-14
lines changed

Diff for: src/pages/Actions/utils.ts

+34-14
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
COMPOUNDING_CONTRACT_ADDRESS,
77
WITHDRAWAL_CONTRACT_ADDRESS,
88
TICKER_NAME,
9+
EXCESS_INHIBITOR,
910
} from '../../utils/envVars';
1011

1112
export type Queue = {
@@ -35,13 +36,23 @@ const getRequiredFee = (queueLength: BigNumber): BigNumber => {
3536
export const getCompoundingQueueLength = async (
3637
web3: Web3
3738
): Promise<BigNumber> => {
38-
const queueLengthHex = await web3.eth.getStorageAt(
39-
COMPOUNDING_CONTRACT_ADDRESS!,
40-
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
41-
);
42-
43-
if (!queueLengthHex)
44-
throw new Error('Unable to get compounding queue length');
39+
let queueLengthHex;
40+
try {
41+
queueLengthHex = await web3.eth.getStorageAt(
42+
COMPOUNDING_CONTRACT_ADDRESS!,
43+
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
44+
);
45+
46+
if (!queueLengthHex) {
47+
throw new Error('Unable to get compounding queue length');
48+
}
49+
if (queueLengthHex === EXCESS_INHIBITOR) {
50+
throw new Error('Compounding queue is disabled');
51+
}
52+
} catch (error) {
53+
console.error(error);
54+
queueLengthHex = '0x0';
55+
}
4556

4657
return new BigNumber(queueLengthHex);
4758
};
@@ -58,13 +69,22 @@ export const getCompoundingQueue = async (web3: Web3): Promise<Queue> => {
5869
export const getWithdrawalQueueLength = async (
5970
web3: Web3
6071
): Promise<BigNumber> => {
61-
const queueLengthHex = await web3.eth.getStorageAt(
62-
WITHDRAWAL_CONTRACT_ADDRESS!,
63-
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
64-
);
65-
66-
if (!queueLengthHex) {
67-
throw new Error('Unable to get withdrawal queue length');
72+
let queueLengthHex;
73+
try {
74+
queueLengthHex = await web3.eth.getStorageAt(
75+
WITHDRAWAL_CONTRACT_ADDRESS!,
76+
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
77+
);
78+
79+
if (!queueLengthHex) {
80+
throw new Error('Unable to get withdrawal queue length');
81+
}
82+
if (queueLengthHex === EXCESS_INHIBITOR) {
83+
throw new Error('Withdrawal queue is disabled');
84+
}
85+
} catch (error) {
86+
console.error(error);
87+
queueLengthHex = '0x0';
6888
}
6989

7090
return new BigNumber(queueLengthHex);

Diff for: src/utils/envVars.ts

+2
Original file line numberDiff line numberDiff line change
@@ -106,3 +106,5 @@ if(process.env.REACT_APP_MAX_QUERY_LIMIT && Number.isNaN(Number(process.env.REAC
106106
throw new Error("REACT_APP_MAX_QUERY_LIMIT must be of type: number")
107107
}
108108
export const MAX_QUERY_LIMIT = Number(process.env.REACT_APP_MAX_QUERY_LIMIT) || 100;
109+
110+
export const EXCESS_INHIBITOR = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";

0 commit comments

Comments
 (0)