Skip to content

Commit 07c61df

Browse files
authored
fix: revert back subquery until url is whitelisted (#2764)
* fix: revert back subquery until url is whitelisted * fix: revert back subquery until url is whitelisted * feat: add expense ratio to poolmetadata
1 parent eac039a commit 07c61df

File tree

7 files changed

+24
-14
lines changed

7 files changed

+24
-14
lines changed

centrifuge-app/.env-config/.env.ff-prod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ REACT_APP_ONBOARDING_API_URL=https://europe-central2-centrifuge-production-x.clo
88
REACT_APP_PINNING_API_URL=https://europe-central2-centrifuge-production-x.cloudfunctions.net/pinning-api-production
99
REACT_APP_POOL_CREATION_TYPE=propose
1010
REACT_APP_RELAY_WSS_URL=wss://rpc.polkadot.io
11-
REACT_APP_SUBQUERY_URL=https://api-main.cfg.embrio.tech/
11+
REACT_APP_SUBQUERY_URL=https://api.centrifuge.io
1212
REACT_APP_SUBSCAN_URL=https://centrifuge.subscan.io
1313
REACT_APP_TINLAKE_NETWORK=mainnet
1414
REACT_APP_INFURA_KEY=8ed99a9a115349bbbc01dcf3a24edc96

centrifuge-app/.env-config/.env.production

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ REACT_APP_ONBOARDING_API_URL=https://europe-central2-centrifuge-production-x.clo
88
REACT_APP_PINNING_API_URL=https://europe-central2-centrifuge-production-x.cloudfunctions.net/pinning-api-production
99
REACT_APP_POOL_CREATION_TYPE=propose
1010
REACT_APP_RELAY_WSS_URL=wss://rpc.polkadot.io
11-
REACT_APP_SUBQUERY_URL=https://api-main.cfg.embrio.tech/
11+
REACT_APP_SUBQUERY_URL=https://api.centrifuge.io
1212
REACT_APP_SUBSCAN_URL=https://centrifuge.subscan.io
1313
REACT_APP_TINLAKE_NETWORK=mainnet
1414
REACT_APP_INFURA_KEY=8ed99a9a115349bbbc01dcf3a24edc96

centrifuge-app/src/components/Dashboard/LandingPage/PoolConfigurationDrawer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,10 @@ export function PoolConfigurationDrawer({ open, setOpen }: PoolConfigurationDraw
231231

232232
const newPoolMetadata: PoolMetadata = {
233233
...pool.meta,
234+
pool: {
235+
...pool.meta.pool,
236+
expenseRatio: values.pool.expenseRatio,
237+
},
234238
holdings: values.holdings,
235239
tranches: values.tranches.reduce((acc, tranche) => {
236240
acc[tranche.id] = {
@@ -337,6 +341,8 @@ export function PoolConfigurationDrawer({ open, setOpen }: PoolConfigurationDraw
337341
})),
338342
]
339343

344+
console.log('newPoolMetadata', newPoolMetadata)
345+
340346
execute([values.id, newPoolMetadata, hasTrancheChanges ? tranches : undefined], { account })
341347
actions.setSubmitting(false)
342348
},
@@ -358,7 +364,6 @@ export function PoolConfigurationDrawer({ open, setOpen }: PoolConfigurationDraw
358364
<LoadBoundary>
359365
<Drawer isOpen={open} onClose={resetToDefault} title="Edit configuration" width="33%">
360366
<Divider color="backgroundSecondary" />
361-
362367
<Select
363368
label="Select pool"
364369
options={poolsWithMetadata.map((pool) => ({

centrifuge-app/src/components/Dashboard/LandingPage/PoolDescriptionSection.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useCentrifuge } from '@centrifuge/centrifuge-react'
2-
import { Box, Grid, ImageUpload, Select, Text, TextInput } from '@centrifuge/fabric'
2+
import { Box, Grid, ImageUpload, NumberInput, Select, Text, TextInput } from '@centrifuge/fabric'
33
import { Field, FieldProps, useFormikContext } from 'formik'
44
import { useEffect, useState } from 'react'
55
import { useTheme } from 'styled-components'
@@ -146,6 +146,15 @@ export function PoolDescriptionSection({ isUpdating }: { isUpdating?: boolean })
146146
/>
147147
)}
148148
</Field>
149+
<Field
150+
name="expenseRatio"
151+
as={NumberInput}
152+
label="Expense ratio"
153+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => form.setFieldValue('pool.expenseRatio', e.target.value)}
154+
value={form.values.pool?.expenseRatio}
155+
placeholder="0.00"
156+
symbol="%"
157+
/>
149158
</Grid>
150159
</Box>
151160
)

centrifuge-app/src/components/PoolOverview/KeyMetrics.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { Decimal } from '../../../src/utils/Decimal'
2020
import { evmChains } from '../../config'
2121
import { formatBalance, formatPercentage } from '../../utils/formatting'
2222
import { useActiveDomains } from '../../utils/useLiquidityPools'
23-
import { useDailyTranchesStates, usePool, usePoolFees, usePoolMetadata } from '../../utils/usePools'
23+
import { useDailyTranchesStates, usePool, usePoolMetadata } from '../../utils/usePools'
2424
import { PoolStatus } from '../PoolCard/PoolStatus'
2525
import { getPoolStatus } from '../PoolList'
2626
import { Spinner } from '../Spinner'
@@ -88,16 +88,9 @@ export const KeyMetrics = ({ poolId }: Props) => {
8888
const isTinlakePool = poolId.startsWith('0x')
8989
const pool = usePool(poolId)
9090
const { data: metadata } = usePoolMetadata(pool)
91-
const poolFees = usePoolFees(poolId)
9291
const tranchesIds = pool.tranches.map((tranche) => tranche.id)
9392
const dailyTranches = useDailyTranchesStates(tranchesIds)
9493

95-
const expenseRatio = useMemo(() => {
96-
return (
97-
poolFees?.map((f) => f.amounts?.percentOfNav.toPercent().toNumber()).reduce((acc, f) => acc + (f ?? 0), 0) ?? 0
98-
)
99-
}, [poolFees])
100-
10194
const tranchesAPY = useMemo(() => {
10295
// TODO: fix when we apy issue is solve, for now we will just use target
10396
// const apy = getTodayValue(dailyTranches)
@@ -187,7 +180,7 @@ export const KeyMetrics = ({ poolId }: Props) => {
187180
: []),
188181
{
189182
metric: <Tooltips type="expenseRatio" size="med" />,
190-
value: expenseRatio ? `${formatBalance(expenseRatio, '', 2)}%` : '-',
183+
value: metadata?.pool?.expenseRatio ? `${formatBalance(metadata?.pool?.expenseRatio, '', 2)}%` : '-',
191184
},
192185
{
193186
metric: 'Weighted Average Maturity',

centrifuge-app/src/components/Report/useReportsQuery.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ type ReportsType = Report | DataReport
4545

4646
const centrifuge = new Centrifuge({
4747
environment: 'mainnet',
48-
indexerUrl: 'https://api-main.cfg.embrio.tech/',
48+
indexerUrl: 'https://api.centrifuge.io/',
4949
})
5050

5151
export function useReport<T extends ReportsType>(

centrifuge-js/src/modules/pools.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -694,6 +694,7 @@ export interface PoolMetadataInput {
694694
website: string
695695
forum: string
696696
email: string
697+
expenseRatio: number
697698
executiveSummary: FileType | null
698699
details?: IssuerDetail[]
699700
issuerCategories: { type: string; value: string; description?: string }[]
@@ -751,6 +752,7 @@ export type PoolMetadata = {
751752
}
752753
investorType: string
753754
poolStructure: string
755+
expenseRatio?: number
754756
poolFees?: {
755757
id: number
756758
name: string
@@ -1173,6 +1175,7 @@ export function getPoolsModule(inst: Centrifuge) {
11731175
shortDescription: metadata.issuerShortDescription,
11741176
categories: metadata.issuerCategories,
11751177
},
1178+
expenseRatio: metadata.expenseRatio ?? 0,
11761179
poolStructure: metadata.poolStructure,
11771180
investorType: metadata.investorType,
11781181
links: {

0 commit comments

Comments
 (0)