Skip to content

Deploy dev into master #740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 34 additions & 14 deletions src/pages/Actions/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
COMPOUNDING_CONTRACT_ADDRESS,
WITHDRAWAL_CONTRACT_ADDRESS,
TICKER_NAME,
EXCESS_INHIBITOR,
} from '../../utils/envVars';

export type Queue = {
Expand Down Expand Up @@ -35,13 +36,23 @@ const getRequiredFee = (queueLength: BigNumber): BigNumber => {
export const getCompoundingQueueLength = async (
web3: Web3
): Promise<BigNumber> => {
const queueLengthHex = await web3.eth.getStorageAt(
COMPOUNDING_CONTRACT_ADDRESS!,
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
);

if (!queueLengthHex)
throw new Error('Unable to get compounding queue length');
let queueLengthHex;
try {
queueLengthHex = await web3.eth.getStorageAt(
COMPOUNDING_CONTRACT_ADDRESS!,
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
);

if (!queueLengthHex) {
throw new Error('Unable to get compounding queue length');
}
if (queueLengthHex === EXCESS_INHIBITOR) {
throw new Error('Compounding queue is disabled');
}
} catch (error) {
console.error(error);
queueLengthHex = '0x0';
}

return new BigNumber(queueLengthHex);
};
Expand All @@ -58,13 +69,22 @@ export const getCompoundingQueue = async (web3: Web3): Promise<Queue> => {
export const getWithdrawalQueueLength = async (
web3: Web3
): Promise<BigNumber> => {
const queueLengthHex = await web3.eth.getStorageAt(
WITHDRAWAL_CONTRACT_ADDRESS!,
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
);

if (!queueLengthHex) {
throw new Error('Unable to get withdrawal queue length');
let queueLengthHex;
try {
queueLengthHex = await web3.eth.getStorageAt(
WITHDRAWAL_CONTRACT_ADDRESS!,
0 // EXCESS_WITHDRAWAL_REQUESTS_STORAGE_SLOT
);

if (!queueLengthHex) {
throw new Error('Unable to get withdrawal queue length');
}
if (queueLengthHex === EXCESS_INHIBITOR) {
throw new Error('Withdrawal queue is disabled');
}
} catch (error) {
console.error(error);
queueLengthHex = '0x0';
}

return new BigNumber(queueLengthHex);
Expand Down
2 changes: 2 additions & 0 deletions src/utils/envVars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,5 @@ if(process.env.REACT_APP_MAX_QUERY_LIMIT && Number.isNaN(Number(process.env.REAC
throw new Error("REACT_APP_MAX_QUERY_LIMIT must be of type: number")
}
export const MAX_QUERY_LIMIT = Number(process.env.REACT_APP_MAX_QUERY_LIMIT) || 100;

export const EXCESS_INHIBITOR = "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff";