|
| 1 | +import type { FragmentOf } from 'gql.tada'; |
| 2 | +import { graphql } from '../graphql'; |
| 3 | +import { ChainFragment } from './chain'; |
| 4 | +import { |
| 5 | + DecimalValueFragment, |
| 6 | + CurrencyFragment, |
| 7 | + NativeCurrencyFragment, |
| 8 | + TokenAmountFragment |
| 9 | +} from './common'; |
| 10 | + |
| 11 | +export const EmodeInfoFragment = graphql( |
| 12 | + `fragment EmodeInfo on EmodeInfo { |
| 13 | + __typename |
| 14 | + maxLTV { |
| 15 | + ...DecimalValue |
| 16 | + } |
| 17 | + liquidationThreshold { |
| 18 | + ...DecimalValue |
| 19 | + } |
| 20 | + liquidationPenalty { |
| 21 | + ...DecimalValue |
| 22 | + } |
| 23 | + }`, |
| 24 | + [DecimalValueFragment], |
| 25 | +); |
| 26 | +export type EmodeInfo = FragmentOf<typeof EmodeInfoFragment>; |
| 27 | + |
| 28 | +export const ReserveSupplyInfoFragment = graphql( |
| 29 | + `fragment ReserveSupplyInfo on ReserveSupplyInfo { |
| 30 | + __typename |
| 31 | + apy { |
| 32 | + ...DecimalValue |
| 33 | + } |
| 34 | + total { |
| 35 | + ...DecimalValue |
| 36 | + } |
| 37 | + maxLTV { |
| 38 | + ...DecimalValue |
| 39 | + } |
| 40 | + liquidationThreshold { |
| 41 | + ...DecimalValue |
| 42 | + } |
| 43 | + liquidationPenalty { |
| 44 | + ...DecimalValue |
| 45 | + } |
| 46 | + canBeCollateral |
| 47 | + }`, |
| 48 | + [DecimalValueFragment], |
| 49 | +); |
| 50 | +export type ReserveSupplyInfo = FragmentOf<typeof ReserveSupplyInfoFragment>; |
| 51 | + |
| 52 | +export const ReserveBorrowInfoFragment = graphql( |
| 53 | + `fragment ReserveBorrowInfo on ReserveBorrowInfo { |
| 54 | + __typename |
| 55 | + apy { |
| 56 | + ...DecimalValue |
| 57 | + } |
| 58 | + total { |
| 59 | + ...DecimalValue |
| 60 | + } |
| 61 | + borrowCap { |
| 62 | + ...DecimalValue |
| 63 | + } |
| 64 | + reserveFactor |
| 65 | + }`, |
| 66 | + [DecimalValueFragment], |
| 67 | +); |
| 68 | +export type ReserveBorrowInfo = FragmentOf<typeof ReserveBorrowInfoFragment>; |
| 69 | + |
| 70 | +export const ReserveUserAvailabilityFragment = graphql( |
| 71 | + `fragment ReserveUserAvailability on ReserveUserAvailability { |
| 72 | + __typename |
| 73 | + balance { |
| 74 | + ...DecimalValue |
| 75 | + } |
| 76 | + supply { |
| 77 | + ...DecimalValue |
| 78 | + } |
| 79 | + borrow { |
| 80 | + ...DecimalValue |
| 81 | + } |
| 82 | + }`, |
| 83 | + [DecimalValueFragment], |
| 84 | +); |
| 85 | +export type ReserveUserAvailability = FragmentOf<typeof ReserveUserAvailabilityFragment>; |
| 86 | + |
| 87 | +export const ReserveFragment = graphql( |
| 88 | + `fragment Reserve on Reserve { |
| 89 | + __typename |
| 90 | + market { |
| 91 | + name |
| 92 | + chain { |
| 93 | + ...Chain |
| 94 | + } |
| 95 | + } |
| 96 | + address |
| 97 | + underlyingToken { |
| 98 | + ...Currency |
| 99 | + } |
| 100 | + aToken { |
| 101 | + ...Currency |
| 102 | + } |
| 103 | + vToken { |
| 104 | + ...Currency |
| 105 | + } |
| 106 | + acceptsNative { |
| 107 | + ...NativeCurrency |
| 108 | + } |
| 109 | + size { |
| 110 | + ...TokenAmount |
| 111 | + } |
| 112 | + utilizationRate { |
| 113 | + ...DecimalValue |
| 114 | + } |
| 115 | + available { |
| 116 | + ...TokenAmount |
| 117 | + } |
| 118 | + usdExchangeRate |
| 119 | + usdOracleAddress |
| 120 | + supplyInfo { |
| 121 | + ...ReserveSupplyInfo |
| 122 | + } |
| 123 | + borrowInfo { |
| 124 | + ...ReserveBorrowInfo |
| 125 | + } |
| 126 | + eModeInfo { |
| 127 | + ...EmodeInfo |
| 128 | + } |
| 129 | + }`, |
| 130 | + [ |
| 131 | + ChainFragment, |
| 132 | + CurrencyFragment, |
| 133 | + NativeCurrencyFragment, |
| 134 | + TokenAmountFragment, |
| 135 | + DecimalValueFragment, |
| 136 | + ReserveSupplyInfoFragment, |
| 137 | + ReserveBorrowInfoFragment, |
| 138 | + EmodeInfoFragment, |
| 139 | + ], |
| 140 | +); |
| 141 | +export type Reserve = FragmentOf<typeof ReserveFragment>; |
0 commit comments