Skip to content
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

Merge hotfix back into main #2437

Merged
merged 3 commits into from
Sep 6, 2024
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
2 changes: 1 addition & 1 deletion centrifuge-app/.env-config/.env.ff-prod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REACT_APP_ONBOARDING_API_URL=https://europe-central2-centrifuge-production-x.clo
REACT_APP_PINNING_API_URL=https://europe-central2-centrifuge-production-x.cloudfunctions.net/pinning-api-production
REACT_APP_POOL_CREATION_TYPE=propose
REACT_APP_RELAY_WSS_URL=wss://rpc.polkadot.io
REACT_APP_SUBQUERY_URL=https://subql.embrio.tech
REACT_APP_SUBQUERY_URL=https://api.centrifuge.io
REACT_APP_SUBSCAN_URL=https://centrifuge.subscan.io
REACT_APP_TINLAKE_NETWORK=mainnet
REACT_APP_INFURA_KEY=8ed99a9a115349bbbc01dcf3a24edc96
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/.env-config/.env.production
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ REACT_APP_ONBOARDING_API_URL=https://europe-central2-centrifuge-production-x.clo
REACT_APP_PINNING_API_URL=https://europe-central2-centrifuge-production-x.cloudfunctions.net/pinning-api-production
REACT_APP_POOL_CREATION_TYPE=propose
REACT_APP_RELAY_WSS_URL=wss://rpc.polkadot.io
REACT_APP_SUBQUERY_URL=https://subql.embrio.tech
REACT_APP_SUBQUERY_URL=https://api.centrifuge.io
REACT_APP_SUBSCAN_URL=https://centrifuge.subscan.io
REACT_APP_TINLAKE_NETWORK=mainnet
REACT_APP_INFURA_KEY=8ed99a9a115349bbbc01dcf3a24edc96
Expand Down
5 changes: 5 additions & 0 deletions centrifuge-app/src/pages/Loan/ExternalFinanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@ export function ExternalFinanceForm({ loan, source }: { loan: ExternalLoan; sour

const withdraw = useWithdraw(loan.poolId, account!, totalFinance, source)

React.useEffect(() => {
financeForm.validateForm()
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [source])

if (loan.status === 'Closed' || ('valuationMethod' in loan.pricing && loan.pricing.valuationMethod !== 'oracle')) {
return null
}
Expand Down
2 changes: 2 additions & 0 deletions centrifuge-app/src/pages/Loan/FinanceForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -561,6 +561,8 @@ export function useWithdraw(poolId: string, borrower: CombinedSubstrateAccount,
return source === 'reserve' ? amount.lte(totalAvailable) && !!withdrawalAddresses.length : true
},
getBatch: () => {
const withdrawalAddresses = Object.values(selectedAddressIndexByCurrency).filter((index) => index !== -1)
if (!withdrawalAddresses.length) return of([])
return combineLatest(
withdrawAmounts.flatMap((bucket) => {
const index = selectedAddressIndexByCurrency[bucket.currencyKey] ?? 0
Expand Down
26 changes: 2 additions & 24 deletions centrifuge-app/src/pages/NavManagement/NavManagementAssetTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { combineLatest, switchMap } from 'rxjs'
import daiLogo from '../../assets/images/dai-logo.svg'
import usdcLogo from '../../assets/images/usdc-logo.svg'
import { ButtonGroup } from '../../components/ButtonGroup'
import { DataCol, DataRow, DataTable } from '../../components/DataTable'
import { DataTable } from '../../components/DataTable'
import { LayoutSection } from '../../components/LayoutBase/LayoutSection'
import { AssetName } from '../../components/LoanList'
import { RouterTextLink } from '../../components/TextLink'
Expand Down Expand Up @@ -386,29 +386,7 @@ export function NavManagementAssetTable({ poolId }: { poolId: string }) {
)
}
>
<DataTable
data={[...reserveRow, ...cashLoans, ...form.values.feed]}
columns={columns}
footer={
<DataRow>
<DataCol align="left">
<Text color="accentPrimary" variant="body2">
Total
</Text>
</DataCol>
<DataCol />
<DataCol />
<DataCol />
<DataCol />
{isEditing && <DataCol />}
<DataCol>
<Text color="accentPrimary" variant="body2">
{formatBalance(newNav, pool.currency.symbol)}
</Text>
</DataCol>
</DataRow>
}
/>
<DataTable data={[...reserveRow, ...cashLoans, ...form.values.feed]} columns={columns} />
</LayoutSection>
</FormikProvider>
</Stack>
Expand Down
6 changes: 5 additions & 1 deletion centrifuge-app/src/pages/NavManagement/Overview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,11 @@ export function NavOverviewCard({ poolId }: { poolId: string }) {
current={pool.nav.total.toFloat()}
change={changeInValuation ? new CurrencyBalance(changeInValuation, pool.currency.decimals).toFloat() : 0}
pendingFees={pendingFees.toFloat()}
pendingNav={pool.nav.total.toFloat() - pendingFees.toFloat()}
pendingNav={new CurrencyBalance(changeInValuation, pool.currency.decimals)
.toDecimal()
.add(pool.nav.total.toDecimal())
.sub(pendingFees.toDecimal())
.toNumber()}
/>
)
}
Expand Down
Loading