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

Arf pool migrate #404

Merged
merged 7 commits into from
Dec 31, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
11 changes: 8 additions & 3 deletions packages/huma-sdk/src/services/SubgraphService.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import {
ARF_3_MONTH_POOL_SCROLL_MAP,
CHAIN_POOLS_INFO_V2,
ChainEnum,
CreditEvent,
isV2Pool,
POOL_NAME,
POOL_TYPE,
PoolContractMap,
PoolSubgraphMap,
RealWorldReceivableInfoBase,
CHAIN_POOLS_INFO_V2,
ChainEnum,
isV2Pool,
requestPost,
} from '@huma-finance/shared'
import { gql } from 'graphql-request'
Expand Down Expand Up @@ -258,6 +259,10 @@ function getReceivableV2Info(
poolAddress = CHAIN_POOLS_INFO_V2[chainId as ChainEnum]?.[poolName]?.pool
}

if (poolAddress === ARF_3_MONTH_POOL_SCROLL_MAP.poolNew) {
poolAddress = ARF_3_MONTH_POOL_SCROLL_MAP.poolOld
}

const ReceivablesV2Query = `
query {
rwreceivables(
Expand Down
20 changes: 10 additions & 10 deletions packages/huma-shared/src/v2/metadata/scroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ export const SCROLL_METADATA: PoolsInfoV2 = {
industry: 'Remittance Financing',
poolName: POOL_NAME.ArfCreditPool3Months,
poolType: POOL_TYPE.ReceivableBackedCreditLine,
pool: '0x5227254a6aCa397e95F310b52f6D3143A5A9Ee14',
poolConfig: '0xEBA0756b813e49bA84Cb3B8E2d717bcF0C07fC99',
poolCredit: '0xc6F10af4746784a0DD095f4E5718d53ff94eB4a0',
poolCreditManager: '0x061411d05074Bc974f814AC86309D2204f4c265d',
poolSafe: '0x7F4f55fAeE753D8dbB3E5F04861dB38E9DB70c3D',
seniorTrancheVault: '0x4cdCedcF50266aD9ed809048BC9874320EC902bC',
juniorTrancheVault: '0x483D02C11f8F1E31C267040A6C86AaB80c428BaB',
epochManager: '0x1a2C87Be5e785493310526faA7739Bbe4E10c0F6',
pool: '0x51051d2E2bac59b525C7f001E91d31193c4CafFe',
poolConfig: '0xcEC52856813d5061FdCDEC8A7464B685294c5cad',
poolCredit: '0x7eb695ad4D4ffC80548b520F3f0E277b14c564db',
poolCreditManager: '0xA4Ab74C3618Eda38DB4E63bA4D91fb5b9aB2b209',
poolSafe: '0x7DFB8cF225e760D69939496eE6BaDA4d660D351b',
seniorTrancheVault: '0xD8208374c5E358031e7A81392F705c04106bB990',
juniorTrancheVault: '0xB135B9cfE868D456B5Fa480817E830960BdE80b3',
epochManager: '0x7297862107E73794BF44332B1654bf3708018310',
receivable: '0x89B599dCc82c42Ef2f17ae39c44e4F6764003518',
poolUnderlyingToken: {
address: '0x06eFdBFf2a14a7c8E15944D1F4A48F9F95F663A4',
Expand All @@ -27,8 +27,8 @@ export const SCROLL_METADATA: PoolsInfoV2 = {
},
firstLossCovers: {
[FirstLossCoverIndex.borrower]:
'0xceA6753113741f82A7a3d86355D4d9BB7126F25E',
[FirstLossCoverIndex.admin]: '0x4222372912cc6554a11ecBeC141cBf6b7d62B630',
'0xb3629a52e5FC292d1f0f8EB927ADabe872b5e5a3',
[FirstLossCoverIndex.admin]: '0xc4E07CFa7Ae39f595895B43bd35dc078f7FE6eF1',
},
seniorAPY: '10-20%',
juniorAPY: '10-20%',
Expand Down
9 changes: 9 additions & 0 deletions packages/huma-shared/src/v2/utils/const.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,3 +57,12 @@ export const ARF_PERSONA_KYC_COPY = {
buttonText: 'GO TO PURCHASE AGREEMENT',
},
}

export const ARF_3_MONTH_POOL_SCROLL_MAP = {
poolOld: '0x5227254a6aCa397e95F310b52f6D3143A5A9Ee14',
poolNew: '0x51051d2E2bac59b525C7f001E91d31193c4CafFe',
seniorTrancheOld: '0x4cdCedcF50266aD9ed809048BC9874320EC902bC',
seniorTrancheNew: '0xD8208374c5E358031e7A81392F705c04106bB990',
juniorTrancheOld: '0x483D02C11f8F1E31C267040A6C86AaB80c428BaB',
juniorTrancheNew: '0xB135B9cfE868D456B5Fa480817E830960BdE80b3',
}
49 changes: 49 additions & 0 deletions packages/huma-web-shared/src/hooks/usePoolV2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,55 @@ export function useCancellableRedemptionInfoV2(
return [redemptionInfo, refresh]
}

type RedemptionStatus = {
numSharesRequested: string
withdrawableAssets: string
cancellableRedemptionShares: string
cancellableRedemptionAssets: string
}

export function useRedemptionStatusV2(
poolName: POOL_NAME,
trancheType: TrancheType,
account: string | undefined,
provider: JsonRpcProvider | Web3Provider | undefined,
): [RedemptionStatus | undefined, () => void] {
const [redemptionStatus, setRedemptionStatus] = useState<RedemptionStatus>()
const vaultContract = useTrancheVaultContractV2(
poolName,
trancheType,
provider,
)
const [refreshCount, refresh] = useForceRefresh()

useEffect(() => {
if (account && vaultContract) {
const fetchData = async () => {
const redemptionRecord = await vaultContract.lenderRedemptionRecords(
account,
)
const cancellableRedemptionShares =
await vaultContract.cancellableRedemptionShares(account)
const cancellableRedemptionAssets = await vaultContract.convertToAssets(
cancellableRedemptionShares,
)
const withdrawableAssets = await vaultContract.withdrawableAssets(
account,
)
setRedemptionStatus({
numSharesRequested: redemptionRecord.numSharesRequested.toString(),
withdrawableAssets: withdrawableAssets.toString(),
cancellableRedemptionShares: cancellableRedemptionShares.toString(),
cancellableRedemptionAssets: cancellableRedemptionAssets.toString(),
})
}
fetchData()
}
}, [account, vaultContract, refreshCount])

return [redemptionStatus, refresh]
}

export function useCreditStatsV2(
poolName: POOL_NAME,
account: string | undefined,
Expand Down
Loading