File tree Expand file tree Collapse file tree 1 file changed +20
-1
lines changed
Expand file tree Collapse file tree 1 file changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -424,6 +424,21 @@ export function EulerSwapViz(props) {
424424 } ;
425425
426426
427+ let priceWarning ;
428+
429+ {
430+ let priceFloat = parseFloat ( params . price ) ;
431+ let oraclePrice = loadPrice ( ) ;
432+ let priceToOracleRatio = priceFloat / oraclePrice ;
433+
434+ if ( isNaN ( priceFloat ) ) priceWarning = 'Missing price' ;
435+ else if ( priceFloat < 1e-7 ) priceWarning = 'Price unexpectedly small' ;
436+ else if ( priceFloat > 1e7 ) priceWarning = 'Price unexpectedly large' ;
437+ else if ( priceToOracleRatio < 1 / 1.1 ) priceWarning = 'Price less than 10% oracle price' ;
438+ else if ( priceToOracleRatio > 1.1 ) priceWarning = 'Price greater than 10% oracle price' ;
439+ }
440+
441+
427442 let parsedPrice = LibEulerSwap . computePriceFraction ( params . price , ctx . vaultDecimals ( props . vault0 ) , ctx . vaultDecimals ( props . vault1 ) ) ;
428443
429444 let paramsRaw = {
@@ -718,7 +733,11 @@ export function EulerSwapViz(props) {
718733 </ div >
719734 </ div >
720735
721- { ! props . viewMode && < div className = "mt-6 flex align-items-center justify-content-center" >
736+ { priceWarning && < div className = "mt-6" style = { { textAlign : 'center' , } } >
737+ < Message severity = "warn" text = { priceWarning } />
738+ </ div > }
739+
740+ { ! props . viewMode && < div className = "mt-4 flex align-items-center justify-content-center" >
722741 < Button className = "mr-6" label = "Install" disabled = { params . concentrationX === undefined || params . concentrationY === undefined || params . fee === undefined || ! parsedPrice [ 0 ] || ! parsedPrice [ 1 ] } onClick = { installEulerSwap } />
723742 < Button className = "mr-6" label = "Show Raw" onClick = { ( ) => setShowRawDialog ( true ) } />
724743 </ div > }
You can’t perform that action at this time.
0 commit comments