File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
apps/hyperdrive-trading/src/ui/hyperdrive/longs/OpenLongPreview Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -78,18 +78,6 @@ export function OpenLongStats({
7878 hyperdriveAddress : hyperdrive . address ,
7979 } ) ;
8080
81- if ( isZapToken && zapTokenPrice && baseTokenPrice ) {
82- const fiatValueOfZapAmount = fixed ( zapTokenPrice ) . mul (
83- amountPaid ,
84- activeToken . decimals ,
85- ) ;
86- const zapAmountInBase = fiatValueOfZapAmount . div ( baseTokenPrice ) ;
87- const slipageAmount = parseFixed ( "0.005" ) ;
88- finalAmountPaid = parseFixed ( "1" )
89- . sub ( slipageAmount )
90- . mul ( zapAmountInBase ) . bigint ;
91- }
92-
9381 const isBaseAmount = asBase || hyperdrive . isSharesPeggedToBase ;
9482 const amountPaidInBase = isBaseAmount
9583 ? amountPaid
@@ -102,6 +90,20 @@ export function OpenLongStats({
10290 const termLengthMS = Number ( hyperdrive . poolConfig . positionDuration * 1000n ) ;
10391 const numDays = convertMillisecondsToDays ( termLengthMS ) ;
10492
93+ if ( isZapToken && zapTokenPrice && baseTokenPrice ) {
94+ const fiatValueOfZapAmount = fixed ( zapTokenPrice ) . mul (
95+ amountPaid ,
96+ activeToken . decimals ,
97+ ) ;
98+ const zapAmountInBase = fiatValueOfZapAmount . div ( baseTokenPrice ) ;
99+ const slipageAmount = parseFixed ( "0.005" ) ;
100+ finalAmountPaid = parseFixed ( "1" )
101+ . sub ( slipageAmount )
102+ . mul ( zapAmountInBase ) . bigint ;
103+ } else {
104+ finalAmountPaid = amountPaidInBase ;
105+ }
106+
105107 return (
106108 < div className = "flex flex-row justify-between px-4 py-8" >
107109 < PrimaryStat
You can’t perform that action at this time.
0 commit comments