Skip to content

Commit

Permalink
Solana mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
mliu committed Oct 22, 2024
1 parent 3f5429a commit 30fcc1c
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 20 deletions.
File renamed without changes.
2 changes: 1 addition & 1 deletion packages/huma-shared/src/solana/idl/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * as HumaSolanaDevnet from './devnet'
export * as HumaSolana from './huma'
export * from './localhost'
5 changes: 3 additions & 2 deletions packages/huma-shared/src/solana/metadata/devnet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { SolanaChainEnum } from '../chain'
import { SolanaChainInfo, SolanaPoolsInfo } from '../pool'

export const SOLANA_DEVNET_INFO: SolanaChainInfo = {
humaProgramAuthority: 'DMEiNSUMjXUXh2XX6gUydSt7Uan5Q4BhAjLJwYxaZUEm',
poolProgram: 'EVQ4s1b6N1vmWFDv8PRNc77kufBP8HcrSNWXQAhRsJq9',
sentinel: '8GQMZVEvYsssewqu2EvoAtVeBMWEkns7vGiUMQ6V7KDo',
}
Expand All @@ -28,7 +27,6 @@ export const SOLANA_DEVNET_METADATA: SolanaPoolsInfo = {
seniorTrancheMint: 'AAZ5cHWkG9XbmQBkKfeFJG1kEsxzFFhonsAinx2K2w9',
seniorTrancheState: '4GKihfFhjGRLn3Bi7PCPzjuaJHPznDB7CioDjMZ7reZP',
trancheDecimals: 6,
receivable: '5o7qiQZeCbTowg75xgB5xMnYRHpXx43c6CnFbnC3MXkJ',
underlyingMint: {
address: '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU',
symbol: 'USDC',
Expand All @@ -38,5 +36,8 @@ export const SOLANA_DEVNET_METADATA: SolanaPoolsInfo = {
KYC: {
Persona: ARF_PERSONA_KYC_COPY,
},
extra: {
hasReceivables: true,
},
},
}
43 changes: 43 additions & 0 deletions packages/huma-shared/src/solana/metadata/mainnet.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { POOL_NAME, POOL_TYPE } from '../../utils/pool'
import { ARF_PERSONA_KYC_COPY } from '../../v2'
import { SolanaChainEnum } from '../chain'
import { SolanaChainInfo, SolanaPoolsInfo } from '../pool'

export const SOLANA_DEVNET_INFO: SolanaChainInfo = {
poolProgram: 'EVQ4s1b6N1vmWFDv8PRNc77kufBP8HcrSNWXQAhRsJq9',
sentinel: 'Huma3jh5pZd1WKKEApB66W5c75vzHfFdRUHM7oMLwdQV', //
}

export const SOLANA_DEVNET_METADATA: SolanaPoolsInfo = {
ArfCreditPool6Months: {
title: 'Arf - Cross Border Payment Financing',
poolName: POOL_NAME.ArfCreditPool6Months,
poolType: POOL_TYPE.CreditLine,
chainId: SolanaChainEnum.SolanaMainnet,
industry: 'Remittance Financing',
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.',
poolId: '6oAuPDYheeDBrmRgY5z1iXvmFwbmtpEGdGBtMCWgAHwb',
poolAuthority: 'FyBd4A7VzeTBP1dyfmmi1rqZYx6wpLT63xKKzngDKu5p',
poolUnderlyingTokenAccount: 'FwZoHpBs1cwHRZzQ9XAzd2Jai4okVVAsNTZbAoEysRpV',
poolConfig: '4beixqv1temogHLmJU98SLpQvGyxkgTyn2AK7dWTr3k8',
humaConfig: 'Fh2WKYCJfota6k76gDGnhTELUuhPa7FHQvVza4cE11ja',
poolState: 'BA1nPxHMnaWiuXeqHSGQntNnx7hobXhHNtiK1PWhrS6E',
juniorTrancheMint: 'EabTCfsZytPd8PRAsSVxcPpMn9hPARLFgvNx6eRjFz1i',
juniorTrancheState: '78Jz2ne15ahye3iC2vVmWF4kDQba7xFFcVE3nT9nE1q6',
seniorTrancheMint: '9J7t9Lnd3bwmACix1Xiw9W3crdtzx6q5Y18LGt25UYco',
seniorTrancheState: 'GGsYvQW5Xw4VLwJAzRA36NHFc146XBQJ6DveR2qBAUgS',
trancheDecimals: 6,
underlyingMint: {
address: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
symbol: 'USDC',
decimals: 6,
icon: 'USDC',
},
KYC: {
Persona: ARF_PERSONA_KYC_COPY,
},
extra: {
hasReceivables: true,
},
},
}
3 changes: 1 addition & 2 deletions packages/huma-shared/src/solana/pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ export type SolanaPoolInfo = {
seniorTrancheState: string
trancheDecimals: number
humaConfig: string
receivable?: string
underlyingMint: {
address: string
symbol: string
Expand All @@ -32,6 +31,7 @@ export type SolanaPoolInfo = {
extra?: {
isClosed?: boolean
hidden?: boolean
hasReceivables?: boolean
}
}

Expand All @@ -49,7 +49,6 @@ export const SOLANA_CHAIN_POOLS_INFO = {

export type SolanaChainInfo = {
poolProgram: string
humaProgramAuthority: string
sentinel: string
}

Expand Down
20 changes: 5 additions & 15 deletions packages/huma-shared/src/solana/utils/programUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { Connection, PublicKey } from '@solana/web3.js'

import { POOL_NAME } from '../../utils'
import { SolanaChainEnum } from '../chain'
import { Huma as HumaSolanaDevnet } from '../idl/devnet'
import HumaDevnetIDL from '../idl/devnet.json'
import { Huma as HumaProgram } from '../idl/huma'
import HumaIDL from '../idl/huma.json'
import {
SOLANA_CHAIN_INFO,
SOLANA_CHAIN_POOLS_INFO,
Expand All @@ -17,9 +17,6 @@ export const getPoolProgramAddress = (chainId: SolanaChainEnum) =>
export const getSentinelAddress = (chainId: SolanaChainEnum) =>
SOLANA_CHAIN_INFO[chainId].sentinel

export const getHumaProgramAuthorityAddress = (chainId: SolanaChainEnum) =>
SOLANA_CHAIN_INFO[chainId].humaProgramAuthority

export const getSolanaPoolInfo = (
chainId: SolanaChainEnum,
poolName: POOL_NAME,
Expand Down Expand Up @@ -47,22 +44,15 @@ export function getSolanaPoolInfoForPoolAddress(
}

export const getHumaProgram = (
chainId: SolanaChainEnum,
_chainId: SolanaChainEnum,
connection: Connection,
wallet?: Wallet,
): Program<HumaSolanaDevnet> => {
): Program<HumaProgram> => {
const provider = wallet
? new AnchorProvider(connection, wallet, {})
: undefined

if (chainId === SolanaChainEnum.SolanaDevnet) {
return new Program<HumaSolanaDevnet>(
HumaDevnetIDL as HumaSolanaDevnet,
provider,
)
}

throw new Error('Chain not supported')
return new Program<HumaProgram>(HumaIDL as HumaProgram, provider)
}

export const getCreditAccounts = (
Expand Down

0 comments on commit 30fcc1c

Please sign in to comment.