Skip to content

Commit

Permalink
Fix linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
kattylucy committed Nov 26, 2024
1 parent fe30f69 commit 31489fd
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion centrifuge-app/src/components/PoolCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ export function PoolCard({
}
})
.reverse()
}, [isTinlakePool, metaData?.tranches, tinlakeKey, tranches])
}, [isTinlakePool, metaData?.tranches, tinlakeKey, tranches, createdAt, poolId])

return (
<RouterTextLink to={`${poolId}`} style={{ textDecoration: 'none' }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,6 @@ export const TrancheTokenCards = ({
return 'mezzanine'
}

const getTarget = (tranche: Token) =>
(isTinlakePool && tranche.seniority === 0) || poolId === DYF_POOL_ID || poolId === NS3_POOL_ID

const columns = useMemo(() => {
return [
{
Expand Down Expand Up @@ -121,6 +118,8 @@ export const TrancheTokenCards = ({
}, [pool.tranches, metadata, poolId, pool?.currency.symbol])

const dataTable = useMemo(() => {
const getTarget = (tranche: Token) =>
(isTinlakePool && tranche.seniority === 0) || poolId === DYF_POOL_ID || poolId === NS3_POOL_ID
return trancheTokens.map((tranche) => {
const calculateApy = (trancheToken: Token) => {
if (isTinlakePool && getTrancheText(trancheToken) === 'senior') return formatPercentage(trancheToken.apy)
Expand All @@ -145,7 +144,7 @@ export const TrancheTokenCards = ({
isTarget: getTarget(tranche),
}
})
}, [trancheTokens, getTarget])
}, [trancheTokens, daysSinceCreation, isTinlakePool, poolId])

return (
<Shelf gap={3}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
TextInput,
} from '@centrifuge/fabric'
import { Field, FieldProps, useFormikContext } from 'formik'
import { useTheme } from 'styled-components'
import { FieldWithErrorMessage } from '../../../src/components/FieldWithErrorMessage'
import { Tooltips } from '../../../src/components/Tooltips'
import { isTestEnv } from '../../../src/config'
Expand All @@ -27,7 +26,6 @@ export const AddButton = ({ onClick }: { onClick: () => void }) => (
)

export const PoolDetailsSection = () => {
const theme = useTheme()
const form = useFormikContext<PoolMetadataInput>()
const createLabel = (label: string) => `${label}${isTestEnv ? '' : '*'}`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import { Field, FieldArray, FieldProps, useFormikContext } from 'formik'
import { useTheme } from 'styled-components'
import { FieldWithErrorMessage } from '../../../src/components/FieldWithErrorMessage'
import { Tooltips } from '../../../src/components/Tooltips'
import { feeCategories, isTestEnv } from '../../../src/config'
import { feeCategories } from '../../../src/config'
import { AddButton } from './PoolDetailsSection'
import { CheckboxOption, Line, StyledGrid } from './PoolStructureSection'

const MAX_FEES = 5

const FEE_TYPES = [
{ label: 'Direct charge', value: 'chargedUpTo' },
{ label: 'Fixed %', value: 'fixed' },
Expand All @@ -34,7 +32,6 @@ export const PoolSetupSection = () => {
const theme = useTheme()
const form = useFormikContext<PoolMetadataInput>()
const { values } = form
const createLabel = (label: string) => `${label}${isTestEnv ? '' : '*'}`

return (
<Box>
Expand Down
2 changes: 1 addition & 1 deletion centrifuge-app/src/pages/IssuerCreatePool/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const IssuerCreatePoolPage = () => {
const [stepCompleted, setStepCompleted] = useState({ 1: false, 2: false, 3: false })

const form = useFormik({
initialValues: initialValues,
initialValues,
validate: (values) => validateValues(values),
validateOnMount: true,
onSubmit: () => console.log('a'),
Expand Down
5 changes: 5 additions & 0 deletions centrifuge-app/src/pages/IssuerCreatePool/oldindex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,11 @@ function CreatePoolForm() {
cent.pools.createPool(poolArgs, { createType: options?.createType, batch: true }),
]).pipe(
switchMap(([api, poolSubmittable]) => {
// BATCH https://polkadot.js.org/docs/kusama/extrinsics/#batchcalls-veccall
api.tx.utlity
.batch
// create pool current functionality + pure proxy functionality goes here
()
const adminProxyDelegates = multisigAddr
? [multisigAddr]
: (adminMultisig && values.adminMultisig?.signers?.filter((addr) => addr !== address)) ?? []
Expand Down
4 changes: 2 additions & 2 deletions centrifuge-app/src/pages/Pool/Assets/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export function PoolDetailAssets() {
if (!poolId) throw new Error('Pool not found')

const pool = usePool(poolId)
const { data: loans, isLoading } = useLoans(poolId)
const { isLoading: isLoadingSnapshots, data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toString())
const { data: loans } = useLoans(poolId)
const { data: snapshots } = useAllPoolAssetSnapshots(poolId, new Date().toString())
const isTinlakePool = poolId.startsWith('0x')
const basePath = useBasePath()
const cashLoans = (loans ?? []).filter(
Expand Down
8 changes: 6 additions & 2 deletions centrifuge-js/src/modules/pools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -674,6 +674,7 @@ export interface PoolMetadataInput {
tranches: TrancheFormValues[]

// details
poolName: string
assetDenomination: string
investorType: string
poolIcon: FileType | null
Expand Down Expand Up @@ -716,7 +717,10 @@ export interface PoolMetadataInput {
poolFees: { id: number; name: string; feePosition: 'Top of waterfall'; category?: string; feeType: FeeTypes }[]

poolType: 'open' | 'closed'

adminMultisigEnabled: boolean
}

export type WithdrawAddress = {
name?: string
address: string
Expand Down Expand Up @@ -776,7 +780,7 @@ export type PoolMetadata = {
{
icon?: FileType | null
minInitialInvestment?: string
targetAPY?: string // only junior tranche (index: 0) has targetAPY
apy: string
}
>
loanTemplates?: {
Expand Down Expand Up @@ -1118,7 +1122,7 @@ export function getPoolsModule(inst: Centrifuge) {
metadata.tranches.forEach((tranche, index) => {
tranchesById[computeTrancheId(index, poolId)] = {
minInitialInvestment: CurrencyBalance.fromFloat(tranche.minInvestment, currencyDecimals).toString(),
targetAPY: tranche.targetAPY,
apy: tranche.apy,
}
})

Expand Down

0 comments on commit 31489fd

Please sign in to comment.