Skip to content

Commit

Permalink
fix: bump abacus for vault logic and log submission times (#1127)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyleroooo authored Oct 14, 2024
1 parent cc36791 commit 49621c4
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@cosmjs/stargate": "^0.32.1",
"@cosmjs/tendermint-rpc": "^0.32.1",
"@datadog/browser-logs": "^5.23.3",
"@dydxprotocol/v4-abacus": "1.12.18",
"@dydxprotocol/v4-abacus": "1.12.21",
"@dydxprotocol/v4-client-js": "1.10.0",
"@dydxprotocol/v4-localization": "^1.1.216",
"@dydxprotocol/v4-proto": "^7.0.0-dev.0",
Expand Down
8 changes: 4 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions src/constants/analytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,8 @@ export const AnalyticsEvents = unionize(
operation: 'DEPOSIT' | 'WITHDRAW';
amount: number;
amountDiff: number | null | undefined;
submissionTimeBase: number;
submissionTimeTotal: number;
}>(),
VaultOperationProtocolError: ofType<{ operation: 'DEPOSIT' | 'WITHDRAW' }>(),
},
Expand Down
11 changes: 11 additions & 0 deletions src/pages/vaults/VaultDepositWithdrawForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -206,14 +206,19 @@ export const VaultDepositWithdrawForm = ({
return;
}

const startTime = new Date().valueOf();
await depositToMegavault(cachedAmount);
const intermediateTime = new Date().valueOf();
await sleep(INDEXER_LAG_ALLOWANCE);
const finalTime = new Date().valueOf();

track(
AnalyticsEvents.SuccessfulVaultOperation({
amount: MustBigNumber(amount).toNumber(),
operation,
amountDiff: undefined,
submissionTimeBase: intermediateTime - startTime,
submissionTimeTotal: finalTime - startTime,
})
);
notify({
Expand Down Expand Up @@ -259,11 +264,15 @@ export const VaultDepositWithdrawForm = ({
}

const preEstimate = validationResponse.summaryData.estimatedAmountReceived;

const startTime = new Date().valueOf();
const result = await withdrawFromMegavault(
submissionData?.withdraw?.shares,
submissionData?.withdraw?.minAmount
);
const intermediateTime = new Date().valueOf();
await sleep(INDEXER_LAG_ALLOWANCE);
const finalTime = new Date().valueOf();

const events = (result as IndexedTx)?.events;
const actualAmount = events
Expand All @@ -276,6 +285,8 @@ export const VaultDepositWithdrawForm = ({
amount: realAmountReceived,
operation,
amountDiff: Math.abs((preEstimate ?? 0) - (realAmountReceived ?? 0)),
submissionTimeBase: intermediateTime - startTime,
submissionTimeTotal: finalTime - startTime,
})
);
notify({
Expand Down

0 comments on commit 49621c4

Please sign in to comment.