diff --git a/packages/huma-shared/src/v2/metadata/humaTestnet.ts b/packages/huma-shared/src/v2/metadata/humaTestnet.ts index f906d6b..a6d966f 100644 --- a/packages/huma-shared/src/v2/metadata/humaTestnet.ts +++ b/packages/huma-shared/src/v2/metadata/humaTestnet.ts @@ -1,7 +1,7 @@ import { ChainEnum } from '../../utils/chain' import { POOL_NAME, POOL_TYPE } from '../../utils/pool' import { FirstLossCoverIndex } from '../types' -import { PoolsInfoV2 } from '../utils' +import { KYC_PROVIDER, PoolsInfoV2 } from '../utils' export const HUMA_TESTNET_METADATA: PoolsInfoV2 = { JiaV2: { @@ -27,7 +27,35 @@ export const HUMA_TESTNET_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Jia V2 Testing Pool', desc: 'Jia brings real-world asset returns to crypto investors while tackling the multi-trillion-dollar credit gap in emerging markets. By providing blockchain-based financing to small businesses and rewarding borrowers who repay with ownership, Jia enables them to create wealth and prosperity for themselves and their communities.', - supplyLink: 'https://app.huma.finance', + KYC: { + provider: KYC_PROVIDER.Securitize, + signInRequired: { + title: 'Sign In', + description: + 'Please sign in to verify that you are the owner of the wallet.', + }, + verifyIdentity: { + title: 'Verify Identity', + description: `This pool is only available to accredited investors at the moment, with minimum investments of $10,000. Please complete identity verification and investor accreditation via ${KYC_PROVIDER.Securitize}.`, + buttonText: 'VERIFY MY IDENTITY', + }, + emailSignatureLink: { + title: 'Pool Documents', + description: `By lending to this pool, you become a subscriber member of the Jia Pioneer Fund LLC. Please sign the LLC Agreement via DocuSign, securing your off-chain claim to the Fund's returns and collateral.`, + buttonText: 'EMAIL DOCUSIGN LINK', + }, + resendSignatureLink: { + title: 'Resend Documents', + description: `Please check your inbox for the LLC Agreement sent via DocuSign. If you haven't received it, check your spam folder or click below to resend.`, + buttonText: 'RESEND DOCUSIGN LINK', + }, + docUnderReview: { + title: 'Under Review', + description: + 'Your documents are being reviewed and you will be notified upon approval. Thank you for your patience. Any questions? Email invest@jia.xyz.', + buttonText: 'THANK YOU', + }, + }, }, ArfCreditPoolV2: { chainId: ChainEnum.HumaTestnet, @@ -52,6 +80,6 @@ export const HUMA_TESTNET_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Arf V2 Testing Pool', desc: 'Arf provides an innovative on-chain liquidity solution that simplifies cross-border payments by facilitating immediate USDC-based settlements and tokenizing payment orders, enhancing transparency in the process.', - supplyLink: 'https://app.huma.finance', + supplyLink: 'https://uer4clyybno.typeform.com/arfcreditline', }, } diff --git a/packages/huma-shared/src/v2/metadata/localhost.ts b/packages/huma-shared/src/v2/metadata/localhost.ts index 9a18395..b049648 100644 --- a/packages/huma-shared/src/v2/metadata/localhost.ts +++ b/packages/huma-shared/src/v2/metadata/localhost.ts @@ -1,7 +1,7 @@ import { ChainEnum } from '../../utils/chain' import { POOL_NAME, POOL_TYPE } from '../../utils/pool' import { FirstLossCoverIndex } from '../types' -import { PoolsInfoV2 } from '../utils' +import { KYC_PROVIDER, PoolsInfoV2 } from '../utils' export const LOCALHOST_METADATA: PoolsInfoV2 = { JiaV2: { @@ -27,7 +27,35 @@ export const LOCALHOST_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Jia V2 Testing Pool', desc: 'Jia brings real-world asset returns to crypto investors while tackling the multi-trillion-dollar credit gap in emerging markets. By providing blockchain-based financing to small businesses and rewarding borrowers who repay with ownership, Jia enables them to create wealth and prosperity for themselves and their communities.', - supplyLink: 'https://app.huma.finance', + KYC: { + provider: KYC_PROVIDER.Securitize, + signInRequired: { + title: 'Sign In', + description: + 'Please sign in to verify that you are the owner of the wallet.', + }, + verifyIdentity: { + title: 'Verify Identity', + description: `This pool is only available to accredited investors at the moment, with minimum investments of $10,000. Please complete identity verification and investor accreditation via ${KYC_PROVIDER.Securitize}.`, + buttonText: 'VERIFY MY IDENTITY', + }, + emailSignatureLink: { + title: 'Pool Documents', + description: `By lending to this pool, you become a subscriber member of the Jia Pioneer Fund LLC. Please sign the LLC Agreement via DocuSign, securing your off-chain claim to the Fund's returns and collateral.`, + buttonText: 'EMAIL DOCUSIGN LINK', + }, + resendSignatureLink: { + title: 'Resend Documents', + description: `Please check your inbox for the LLC Agreement sent via DocuSign. If you haven't received it, check your spam folder or click below to resend.`, + buttonText: 'RESEND DOCUSIGN LINK', + }, + docUnderReview: { + title: 'Under Review', + description: + 'Your documents are being reviewed and you will be notified upon approval. Thank you for your patience. Any questions? Email invest@jia.xyz.', + buttonText: 'THANK YOU', + }, + }, }, ArfCreditPoolV2: { chainId: ChainEnum.Localhost, @@ -52,6 +80,6 @@ export const LOCALHOST_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Arf V2 Testing Pool', desc: 'Arf provides an innovative on-chain liquidity solution that simplifies cross-border payments by facilitating immediate USDC-based settlements and tokenizing payment orders, enhancing transparency in the process.', - supplyLink: 'https://app.huma.finance', + supplyLink: 'https://uer4clyybno.typeform.com/arfcreditline', }, } diff --git a/packages/huma-shared/src/v2/metadata/mumbai.ts b/packages/huma-shared/src/v2/metadata/mumbai.ts index 08d13ac..e252995 100644 --- a/packages/huma-shared/src/v2/metadata/mumbai.ts +++ b/packages/huma-shared/src/v2/metadata/mumbai.ts @@ -1,7 +1,7 @@ import { ChainEnum } from '../../utils/chain' import { POOL_NAME, POOL_TYPE } from '../../utils/pool' import { FirstLossCoverIndex } from '../types' -import { PoolsInfoV2 } from '../utils' +import { KYC_PROVIDER, PoolsInfoV2 } from '../utils' export const MUMBAI_METADATA: PoolsInfoV2 = { JiaV2: { @@ -27,7 +27,35 @@ export const MUMBAI_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Jia V2 Testing Pool', desc: 'Jia brings real-world asset returns to crypto investors while tackling the multi-trillion-dollar credit gap in emerging markets. By providing blockchain-based financing to small businesses and rewarding borrowers who repay with ownership, Jia enables them to create wealth and prosperity for themselves and their communities.', - supplyLink: 'https://app.huma.finance', + KYC: { + provider: KYC_PROVIDER.Securitize, + signInRequired: { + title: 'Sign In', + description: + 'Please sign in to verify that you are the owner of the wallet.', + }, + verifyIdentity: { + title: 'Verify Identity', + description: `This pool is only available to accredited investors at the moment, with minimum investments of $10,000. Please complete identity verification and investor accreditation via ${KYC_PROVIDER.Securitize}.`, + buttonText: 'VERIFY MY IDENTITY', + }, + emailSignatureLink: { + title: 'Pool Documents', + description: `By lending to this pool, you become a subscriber member of the Jia Pioneer Fund LLC. Please sign the LLC Agreement via DocuSign, securing your off-chain claim to the Fund's returns and collateral.`, + buttonText: 'EMAIL DOCUSIGN LINK', + }, + resendSignatureLink: { + title: 'Resend Documents', + description: `Please check your inbox for the LLC Agreement sent via DocuSign. If you haven't received it, check your spam folder or click below to resend.`, + buttonText: 'RESEND DOCUSIGN LINK', + }, + docUnderReview: { + title: 'Under Review', + description: + 'Your documents are being reviewed and you will be notified upon approval. Thank you for your patience. Any questions? Email invest@jia.xyz.', + buttonText: 'THANK YOU', + }, + }, }, ArfCreditPoolV2: { chainId: ChainEnum.Mumbai, @@ -52,6 +80,6 @@ export const MUMBAI_METADATA: PoolsInfoV2 = { juniorAPY: '10-20%', title: 'Arf V2 Testing Pool', desc: 'Arf provides an innovative on-chain liquidity solution that simplifies cross-border payments by facilitating immediate USDC-based settlements and tokenizing payment orders, enhancing transparency in the process.', - supplyLink: 'https://app.huma.finance', + supplyLink: 'https://uer4clyybno.typeform.com/arfcreditline', }, } diff --git a/packages/huma-shared/src/v2/utils/const.ts b/packages/huma-shared/src/v2/utils/const.ts index 2f1ee7e..a4d02d6 100644 --- a/packages/huma-shared/src/v2/utils/const.ts +++ b/packages/huma-shared/src/v2/utils/const.ts @@ -2,6 +2,10 @@ import { BigNumber } from 'ethers' export const BP_FACTOR = BigNumber.from(10000) +export enum KYC_PROVIDER { + Securitize = 'Securitize', +} + export enum CreditStateV2 { Deleted, Paused, diff --git a/packages/huma-widget/src/components/Lend/supplyV2/1-ChooseTranche.tsx b/packages/huma-widget/src/components/Lend/supplyV2/1-ChooseTranche.tsx index 0d81c67..488bd8a 100644 --- a/packages/huma-widget/src/components/Lend/supplyV2/1-ChooseTranche.tsx +++ b/packages/huma-widget/src/components/Lend/supplyV2/1-ChooseTranche.tsx @@ -1,10 +1,4 @@ -import { - openInNewTab, - PoolInfoV2, - TrancheType, - UnderlyingTokenInfo, - useLenderApprovedV2, -} from '@huma-finance/shared' +import { TrancheType, UnderlyingTokenInfo } from '@huma-finance/shared' import { css, FormControl, @@ -14,7 +8,6 @@ import { RadioGroup, useTheme, } from '@mui/material' -import { useWeb3React } from '@web3-react/core' import React from 'react' import { useAppDispatch } from '../../../hooks/useRedux' @@ -22,39 +15,20 @@ import { setStep } from '../../../store/widgets.reducers' import { WIDGET_STEP } from '../../../store/widgets.store' import { BottomButton } from '../../BottomButton' import { WrapperModal } from '../../WrapperModal' -import { LoadingModal } from '../../LoadingModal' type Props = { - poolInfo: PoolInfoV2 poolUnderlyingToken: UnderlyingTokenInfo selectedTranche: TrancheType | undefined changeTranche: (tranche: TrancheType) => void } export function ChooseTranche({ - poolInfo, poolUnderlyingToken, selectedTranche, changeTranche, }: Props): React.ReactElement | null { const theme = useTheme() - const { poolName } = poolInfo const dispatch = useAppDispatch() - const { account, provider } = useWeb3React() - const [lenderApprovedSenior] = useLenderApprovedV2( - poolName, - 'senior', - account, - provider, - ) - const [lenderApprovedJunior] = useLenderApprovedV2( - poolName, - 'junior', - account, - provider, - ) - const isLoading = - lenderApprovedSenior === undefined || lenderApprovedJunior === undefined const styles = { subTitle: css` @@ -84,16 +58,7 @@ export function ChooseTranche({ } const handleNext = () => { - if ( - (selectedTranche === 'senior' && lenderApprovedSenior) || - (selectedTranche === 'junior' && lenderApprovedJunior) - ) { - dispatch(setStep(WIDGET_STEP.ChooseAmount)) - } else if (poolInfo.KYC) { - dispatch(setStep(WIDGET_STEP.Evaluation)) - } else if (poolInfo.supplyLink) { - openInNewTab(poolInfo.supplyLink) - } + dispatch(setStep(WIDGET_STEP.ChooseAmount)) } const items: { @@ -110,10 +75,6 @@ export function ChooseTranche({ }, ] - if (isLoading) { - return - } - return ( diff --git a/packages/huma-widget/src/components/Lend/supplyV2/index.tsx b/packages/huma-widget/src/components/Lend/supplyV2/index.tsx index 5fdb73b..5f3464b 100644 --- a/packages/huma-widget/src/components/Lend/supplyV2/index.tsx +++ b/packages/huma-widget/src/components/Lend/supplyV2/index.tsx @@ -1,6 +1,8 @@ import { POOL_NAME, TrancheType, + openInNewTab, + useLenderApprovedV2, usePoolInfoV2, usePoolUnderlyingTokenInfoV2, } from '@huma-finance/shared' @@ -42,19 +44,66 @@ export function LendSupplyV2({ }: LendSupplyPropsV2): React.ReactElement | null { const dispatch = useDispatch() const poolName = POOL_NAME[poolNameStr] - const { chainId, provider } = useWeb3React() + const { chainId, provider, account } = useWeb3React() const poolInfo = usePoolInfoV2(poolName, chainId) const { step, errorMessage } = useAppSelector(selectWidgetState) const [selectedTranche, setSelectedTranche] = useState() const poolUnderlyingToken = usePoolUnderlyingTokenInfoV2(poolName, provider) + const [lenderApprovedSenior] = useLenderApprovedV2( + poolName, + 'senior', + account, + provider, + ) + const [lenderApprovedJunior] = useLenderApprovedV2( + poolName, + 'junior', + account, + provider, + ) + + const lenderApproveStatusFetched = + lenderApprovedSenior !== undefined && lenderApprovedJunior !== undefined + useEffect(() => { - if (!step) { - dispatch(setStep(WIDGET_STEP.ChooseTranche)) + if (!step && poolInfo && lenderApproveStatusFetched) { + if (lenderApprovedJunior && !lenderApprovedSenior) { + setSelectedTranche('junior') + dispatch(setStep(WIDGET_STEP.ChooseAmount)) + return + } + + if (lenderApprovedSenior && !lenderApprovedJunior) { + setSelectedTranche('senior') + dispatch(setStep(WIDGET_STEP.ChooseAmount)) + return + } + + if (lenderApprovedJunior && lenderApprovedSenior) { + dispatch(setStep(WIDGET_STEP.ChooseTranche)) + return + } + + if (poolInfo.KYC) { + dispatch(setStep(WIDGET_STEP.Evaluation)) + return + } + + if (poolInfo.supplyLink) { + openInNewTab(poolInfo.supplyLink) + } } - }, [dispatch, step]) + }, [ + dispatch, + lenderApproveStatusFetched, + lenderApprovedJunior, + lenderApprovedSenior, + poolInfo, + step, + ]) - if (!poolInfo || !poolUnderlyingToken) { + if (!poolInfo || !poolUnderlyingToken || !lenderApproveStatusFetched) { return ( {step === WIDGET_STEP.ChooseTranche && (