Skip to content

Commit

Permalink
Merge pull request #76 from RealToken-Community/develop
Browse files Browse the repository at this point in the history
merge preprod <> develop
  • Loading branch information
AlexRLT authored Aug 30, 2024
2 parents 8ba6b9a + c0fe9df commit 072a3c7
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 16 deletions.
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
40 changes: 26 additions & 14 deletions src/hooks/useFullyRentedAPR.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,9 @@ import {

const fullyRentedAPREstimation = (token: UserRealtoken) => {
// VEFA properties
if (token.shortName === 'Playa Caracol Cottage 10' && !token.hasTenants)
return 10.77
else if (token.shortName === 'Playa Caracol 303300' && !token.hasTenants)
return 10.69
else if (token.shortName === 'Playa Caracol 303200' && !token.hasTenants)
return 10.8
else if (token.shortName === 'PH Pinoalto A002' && !token.hasTenants)
return 10.11
else if (token.shortName === 'PH Pinoalto A003' && !token.hasTenants)
return 10.11
else if (token.shortName === 'Vervana T1 ' && !token.hasTenants) return 11.33
if (isVEFA(token)) {
return VEFAAPRs[token.shortName as keyof typeof VEFAAPRs]
}

if (token.rentedUnits === token.totalUnits) {
// Case of fully rented property
Expand Down Expand Up @@ -71,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 @@ -83,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 @@ -109,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
3 changes: 2 additions & 1 deletion 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

0 comments on commit 072a3c7

Please sign in to comment.