Skip to content

Commit

Permalink
merge preprod <> master (#77)
Browse files Browse the repository at this point in the history
* add dropdown

* simplify selector and add all token option

* feat: change allPage value to Infinity

* feat: estimate the fully rented rent

* feat: add fully rented estimation to asset cards

* refactor: move hook calls to top of the page

* fix: propInfo definition

* fix: last rent condition

* feat: add estimation for property with not fully rented history

* feat: get fully rented APR

* apply max APR method

* rename variable and functions

* feat: add RWA token

* feat: re-enable property onClick

* feat: add rwa valuation on the rwa card

* fix: missing property

* feat: add rwa to summary card

* define useRWA

* take into account user currency

* feat: add RWA value to net value calculation

* remove comment

* refactor: clean imports

* feat: include RWA on Ethereum

* fix: en communs

* feat: update filter to support RWA token

* fix: prettier

* fix: other prettier errors

* let prettier add strange semi-column

* fix: imports

* use hook

* add fallback

* switch for a useMemo

* feat: add real time fully rented APR

* feat: add gloabl metric fully rented APR

* feat: add disclaimer

* feat: add disclaimer

* feat: update disclaimer message

* fix: disclaimer message

* improve message

* feat: create yam statics stics page

* feat: add yam statistics for all RealT Tokens on Gnosis (who have Gnosis chain contract prop)

* feat: mask tokens with no volume

* fix: add token name

* feat: add pagination

* feat: improve style

* feat: change token per page to 100

* feat: add fully rented APR to asset grid

* refactor: remove logs

* feat: add fully rented APR to property details

* fix: reset current page when tokens changed

* fix: reset current page when user change page size

* feat: add translation for YAM statistics hearder label

* fix: yamStatistics: use selected currency for token price

* feat: yamStatistics: add owned | all filter

* feat: yamStatistics: add subsidized, fullySubsidized and notSubsidized filters

* add additional fallbacks RPC URLs

* fix: RPC initialization on currencies file

* feat: YamStatistic: add Yamp Volume's number of days

* fix: fullyRentedAPR: fix french disclaimer text

* fix: second disclaimer text small error

* feat: fullyRentedAPR: manage VEFA properties

* refactore: improve comment

* feat: show VEFA properties forced fully rented APR only if property do not have tenants

* fix: RWA table view

* feat: add bridge link on header (#74)

* fix: VEFA Realtime  APR

---------

Co-authored-by: Nandy Bâ <[email protected]>
Co-authored-by: Yohann Durand <[email protected]>
  • Loading branch information
3 people authored Aug 31, 2024
1 parent 3f46b2d commit 68daad5
Show file tree
Hide file tree
Showing 6 changed files with 100 additions and 8 deletions.
60 changes: 59 additions & 1 deletion src/components/assetsView/views/AssetTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const AssetTable: FC<{
{props.realtokens.map((item, index) => {
const isAProperty = item.hasOwnProperty('rentStatus')
if (!isAProperty) {
return <AssetTableRow key={'0'} value={item as UserRealtoken} />
return <RWATableRow key={'0'} value={item as RWARealtoken} />
}
return <AssetTableRow key={index} value={item as UserRealtoken} />
})}
Expand Down Expand Up @@ -159,4 +159,62 @@ const AssetTableRow: FC<{ value: UserRealtoken }> = (props) => {
</Table.Tr>
)
}

const RWATableRow: FC<{ value: RWARealtoken }> = (props) => {
const { t } = useTranslation('common', { keyPrefix: 'numbers' })
const transfersIsLoaded = useSelector(selectTransfersIsLoaded)

const { shortName, value, unitPriceCost, amount, totalInvestment } =
props.value

return (
<Table.Tr>
<Table.Td style={{ minWidth: '150px' }}>
<Anchor>{shortName}</Anchor>
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{useCurrencyValue(value)}
</Table.Td>
{transfersIsLoaded ? (
<>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
</>
) : null}

<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{useCurrencyValue(unitPriceCost)}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{t('decimal', { value: amount })}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{useCurrencyValue(totalInvestment)}
</Table.Td>
<Table.Td style={{ textAlign: 'right', whiteSpace: 'nowrap' }}>
{'-'}
</Table.Td>
</Table.Tr>
)
}

AssetTableRow.displayName = 'AssetTableRow'
7 changes: 7 additions & 0 deletions src/components/layouts/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,13 @@ export const Header: FC = () => {
label={t('YAM')}
leftSection={<IconExternalLink size={'1rem'} stroke={1.5} />}
/>
<NavLink
component={'a'}
href={'https://bridge.realtoken.network/'}
target={'_blank'}
label={t('Bridge')}
leftSection={<IconExternalLink size={'1rem'} stroke={1.5} />}
/>
</Drawer>
<div>
<Box className={styles.container}>
Expand Down
31 changes: 28 additions & 3 deletions src/hooks/useFullyRentedAPR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ import {
} from 'src/types/RentCalculation'

const fullyRentedAPREstimation = (token: UserRealtoken) => {
// VEFA properties
if (isVEFA(token)) {
return VEFAAPRs[token.shortName as keyof typeof VEFAAPRs]
}

// Case of fully rented property
if (token.rentedUnits === token.totalUnits) {
return token.annualPercentageYield
Expand Down Expand Up @@ -58,7 +63,7 @@ export const useFullyRentedAPR = (token: UserRealtoken) => {

const fullyRentedAPR = useMemo(() => {
const isDisabled = APRDisabled(rentCalculation, token)
if (isDisabled) return 0
if (isDisabled && !isVEFA(token)) return 0
return fullyRentedAPREstimation(token)
}, [token, rentCalculation])

Expand All @@ -70,12 +75,12 @@ export const useGeneralFullyRentedAPR = (tokens: UserRealtoken[]) => {
// Fully rented APR average using valuation ponderation
const fullyRentedAPR = useMemo(() => {
const totalValue = tokens.reduce((acc, token) => {
const isDisabled = APRDisabled(rentCalculation, token)
const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token)
if (isDisabled) return acc
return acc + token.value
}, 0)
const totalAPR = tokens.reduce((acc, token) => {
const isDisabled = APRDisabled(rentCalculation, token)
const isDisabled = APRDisabled(rentCalculation, token) && !isVEFA(token)
if (isDisabled) return acc
return acc + token.value * fullyRentedAPREstimation(token)
}, 0)
Expand All @@ -96,3 +101,23 @@ const APRDisabled = (
rentStartDate > realtimeDate.toDate()
return isDisabled
}

export const isVEFA = (token: UserRealtoken) => {
return (
token.shortName === 'Playa Caracol Cottage 10' ||
token.shortName === 'Playa Caracol 303300' ||
token.shortName === 'Playa Caracol 303200' ||
token.shortName === 'PH Pinoalto A002' ||
token.shortName === 'PH Pinoalto A003' ||
token.shortName === 'Vervana T1 '
)
}

const VEFAAPRs = {
'Playa Caracol Cottage 10': 10.77,
'Playa Caracol 303300': 10.69,
'Playa Caracol 303200': 10.8,
'PH Pinoalto A002': 10.11,
'PH Pinoalto A003': 10.11,
'Vervana T1 ': 11.33,
}
3 changes: 2 additions & 1 deletion src/i18next/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"home": "Home",
"realt": "RealT",
"RMM": "RMM",
"YAM": "YAM"
"YAM": "YAM",
"Bridge": "Bridge"
},
"settings": {
"title": "Language",
Expand Down
5 changes: 3 additions & 2 deletions src/i18next/locales/fr/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"home": "Accueil",
"realt": "RealT",
"RMM": "RMM",
"YAM": "YAM"
"YAM": "YAM",
"Bridge": "Bridge"
},
"settings": {
"title": "Langue",
Expand Down Expand Up @@ -395,6 +396,6 @@
"description": "Récupération de vos transactions en cours. Ce chargement peut prendre un certain temps en fonction du nombre de transactions effecutées (10-20 secondes / 1000 transactions). Lors de vos prochaines visites, seul les nouvelles transactions seront récupérées."
},
"disclaimer":{
"fullyRentedAPR": "Cette estimation est en phase bêta et a été développée par la communauté RealT. Nous vous invitons à signaler tout problème éventuel. Les informations fournies sont à titre indicatif uniquement. La communauté RealT ou RealT ne peut être tenu responsable en cas de décision prise à partir de données inexactites."
"fullyRentedAPR": "Cette estimation est en phase bêta et a été développée par la communauté RealT. Nous vous invitons à signaler tout problème éventuel. Les informations fournies sont à titre indicatif uniquement. La communauté RealT ou RealT ne peut être tenue responsable en cas de décision prise à partir de données inexactes."
}
}
2 changes: 1 addition & 1 deletion src/pages/yamStatistics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ const YamStatisticsPage = () => {
<th>Token Price</th>
<th>Yam Price</th>
<th>Yam Difference (30 days)</th>
<th>Yam Volume</th>
<th>Yam Volume (30 days)</th>
</tr>
{paginationYamStatistics.map((statistics, index) => (
<YamStatisticsRow
Expand Down

0 comments on commit 68daad5

Please sign in to comment.