Skip to content

Commit 60a4e66

Browse files
committed
Merge branch 'prd-fix' into staging
2 parents 94213e3 + c954bf6 commit 60a4e66

File tree

1 file changed

+16
-1
lines changed
  • packages/webapp/src/pages/VaultPage/DashBoardPanel

1 file changed

+16
-1
lines changed

packages/webapp/src/pages/VaultPage/DashBoardPanel/hook.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import {
2727
globalSetup,
2828
L1L2_NAME_DEFINED,
2929
MapChainId,
30+
myLog,
3031
RouterPath,
3132
SagaStatus,
3233
SoursURL,
@@ -46,6 +47,14 @@ import { useHistory } from 'react-router-dom'
4647

4748
const VaultPath = `${RouterPath.vault}/:item/:method?`
4849

50+
const parseVaultTokenStatus = (status: number) => ({
51+
show: status & 1,
52+
join: status & 2,
53+
exit: status & 4,
54+
loan: status & 8,
55+
repay: status & 16,
56+
})
57+
4958
export const useGetVaultAssets = <R extends VaultDataAssetsItem>({
5059
vaultAccountInfo: _vaultAccountInfo,
5160
}: {
@@ -371,13 +380,15 @@ export const useGetVaultAssets = <R extends VaultDataAssetsItem>({
371380
},
372381
} = store.getState()
373382
const walletMap = makeVaultLayer2({ needFilterZero: false }).vaultLayer2Map ?? {}
383+
myLog('asdfhsjdhfjsd', tokenMap, walletMap)
374384
if (
375385
tokenMap &&
376386
!!Object.keys(tokenMap).length &&
377387
!!Object.keys(walletMap ?? {}).length
378388
) {
379389
let totalAssets = sdk.toBig(0)
380-
let data: Array<any> = Object.keys(tokenMap ?? {}).reduce((pre, key, _index) => {
390+
let data: Array<any> = Object.keys(tokenMap ?? {})
391+
.reduce((pre, key, _index) => {
381392
let item: any
382393
// tokenInfo
383394
let tokenInfo = {
@@ -443,6 +454,10 @@ export const useGetVaultAssets = <R extends VaultDataAssetsItem>({
443454
})
444455
return pre
445456
}, [] as Array<any>)
457+
.filter(token => {
458+
const status = tokenMap['LV' + token.erc20Symbol].vaultTokenAmounts.status as number
459+
return parseVaultTokenStatus(status).loan && parseVaultTokenStatus(status).repay
460+
})
446461
setAssetsRawData(data)
447462
setTotalAsset(totalAssets.toString())
448463
} else {

0 commit comments

Comments
 (0)