@@ -14,6 +14,8 @@ import { LabelValue } from "src/ui/base/components/LabelValue";
14
14
import { formatBalance } from "src/ui/base/formatting/formatBalance" ;
15
15
import { formatDate } from "src/ui/base/formatting/formatDate" ;
16
16
import { useFixedRate } from "src/ui/hyperdrive/longs/hooks/useFixedRate" ;
17
+ import { useShortRate } from "src/ui/hyperdrive/shorts/hooks/useShortRate" ;
18
+ import { useYieldSourceRate } from "src/ui/vaults/useYieldSourceRate" ;
17
19
interface OpenShortPreviewProps {
18
20
hyperdrive : HyperdriveConfig ;
19
21
tokenIn : TokenConfig < any > ;
@@ -40,6 +42,16 @@ export function OpenShortPreview({
40
42
} ) ;
41
43
const { fixedApr } = useFixedRate ( hyperdrive . address ) ;
42
44
const termLengthMS = Number ( hyperdrive . poolConfig . positionDuration * 1000n ) ;
45
+ const { vaultRate } = useYieldSourceRate ( {
46
+ hyperdriveAddress : hyperdrive . address ,
47
+ } ) ;
48
+ const { shortApr, shortRateStatus } = useShortRate ( {
49
+ bondAmount : shortSize ,
50
+ hyperdriveAddress : hyperdrive . address ,
51
+ timestamp : BigInt ( Math . floor ( Date . now ( ) / 1000 ) ) ,
52
+ variableApy : vaultRate ?. vaultRate ,
53
+ } ) ;
54
+
43
55
return (
44
56
< div className = "flex flex-col gap-3" >
45
57
< LabelValue
@@ -101,6 +113,26 @@ export function OpenShortPreview({
101
113
)
102
114
}
103
115
/>
116
+ < LabelValue
117
+ label = "Net Short Rate"
118
+ value = {
119
+ shortRateStatus === "loading" ? (
120
+ < Skeleton width = { 100 } />
121
+ ) : (
122
+ < span
123
+ className = { classNames (
124
+ "daisy-tooltip daisy-tooltip-top daisy-tooltip-left cursor-help before:border" ,
125
+ {
126
+ "border-b border-dashed border-current" : spotRateAfterOpen ,
127
+ } ,
128
+ ) }
129
+ data-tip = "The annualized return on shorts assuming the current yield source rate stays the same for one year"
130
+ >
131
+ { shortApr ? `${ shortApr . formatted } % APR` : "-" }
132
+ </ span >
133
+ )
134
+ }
135
+ />
104
136
< div className = "flex flex-col gap-3" >
105
137
< h6 className = "font-medium" > Market Impact</ h6 >
106
138
< LabelValue
0 commit comments