Scope Funding to actions, enable fund for USDC (and others) (#426)

* fix vault test and vaulttable pos value

* fix vault test and vaulttable pos value updated

* Scope lend for deposit to action only

* fix build error

* fix build error
This commit is contained in:
Bob van der Helm
2023-09-05 12:45:55 +02:00
committed by GitHub
parent 19e06aa7d4
commit 46d4113d98
14 changed files with 96 additions and 51 deletions
+10 -4
View File
@@ -3,13 +3,15 @@ import moment from 'moment'
import { getClient, getCreditManagerQueryClient, getVaultQueryClient } from 'api/cosmwasm-client'
import getPrice from 'api/prices/getPrice'
import getVaults from 'api/vaults/getVaults'
import { BN_ZERO } from 'constants/math'
import { BNCoin } from 'types/classes/BNCoin'
import { VaultStatus } from 'types/enums/vault'
import {
VaultPosition,
VaultPositionAmount,
} from 'types/generated/mars-credit-manager/MarsCreditManager.types'
import { getCoinValue } from 'utils/formatters'
import { BN } from 'utils/helpers'
import { BN_ZERO } from 'constants/math'
async function getUnlocksAtTimestamp(unlockingId: number, vaultAddress: string) {
try {
@@ -130,8 +132,12 @@ async function getVaultValuesAndAmounts(
secondary: BN(secondaryLpToken.amount),
},
values: {
primary: BN(primaryLpToken.amount).multipliedBy(primaryPrice),
secondary: BN(secondaryLpToken.amount).multipliedBy(secondaryPrice),
primary: getCoinValue(new BNCoin(primaryLpToken), [
BNCoin.fromDenomAndBigNumber(primaryLpToken.denom, primaryPrice),
]),
secondary: getCoinValue(new BNCoin(secondaryLpToken), [
BNCoin.fromDenomAndBigNumber(secondaryLpToken.denom, secondaryPrice),
]),
},
}
} catch (ex) {
@@ -173,4 +179,4 @@ async function getDepositedVaults(accountId: string): Promise<DepositedVault[]>
}
}
export default getDepositedVaults
export default getDepositedVaults