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 preprod <> develop #76

Merged
merged 3 commits into from
Aug 30, 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
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
Loading