Skip to content

Commit 365497d

Browse files
committed
rename variables
1 parent 620d7f4 commit 365497d

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/EulerSwap.jsx

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ export function EulerSwapViz(props) {
300300
let nav = v0status.value + v1status.value - v0status.debtValue - v1status.debtValue;
301301
let navNum = ctx.valueToNum(nav);
302302

303-
let ltv0, ltv1;
303+
let limit0, limit1;
304304

305305
if (debtVaultIndex !== undefined && debtVaultIndex !== v0Index && debtVaultIndex !== v1Index) {
306306
// Special case where the liability vault is not one of the configured vaults
@@ -316,15 +316,15 @@ export function EulerSwapViz(props) {
316316
let split = (netDebt - adj1) / (adj0 - adj1);
317317

318318
if (navNum * ltvMatrix[v0Index][debtVaultIndex] > netDebt) {
319-
ltv0 = -navNum/2;
319+
limit0 = -navNum/2;
320320
} else {
321-
ltv0 = (1 - split) * -navNum/2;
321+
limit0 = (1 - split) * -navNum/2;
322322
}
323323

324324
if (navNum * ltvMatrix[v1Index][debtVaultIndex] > netDebt) {
325-
ltv1 = navNum/2;
325+
limit1 = navNum/2;
326326
} else {
327-
ltv1 = split * navNum/2;
327+
limit1 = split * navNum/2;
328328
}
329329
} else {
330330
// Normal case where one of the configured vaults is the liability
@@ -338,13 +338,13 @@ export function EulerSwapViz(props) {
338338
}
339339
let ltvPair = [ltvMatrix[v1Index][v0Index], ltvMatrix[v0Index][v1Index]];
340340

341-
ltv0 = -(navNum + extracollateral0) / (1 - ltvPair[1]);
342-
ltv1 = (navNum + extracollateral1) / (1 - ltvPair[0]);
341+
limit0 = -(navNum + extracollateral0) / (1 - ltvPair[1]);
342+
limit1 = (navNum + extracollateral1) / (1 - ltvPair[0]);
343343
}
344344

345345

346346

347-
let maxDomain = 1.05 * Math.max(Math.abs(ltv0), Math.abs(ltv1));
347+
let maxDomain = 1.05 * Math.max(Math.abs(limit0), Math.abs(limit1));
348348
if (domain === undefined) setDomain(props.initialDomain || maxDomain);
349349

350350
let navMidpoint;
@@ -375,9 +375,9 @@ export function EulerSwapViz(props) {
375375
concentrationY: parseUnits("0.9", 18),
376376
fee: parseUnits("0.001", 18),
377377
price: loadPrice(),
378-
curveLeft: ltv0,
378+
curveLeft: limit0,
379379
curveMid: navMidpoint,
380-
curveRight: ltv1,
380+
curveRight: limit1,
381381
});
382382
return;
383383
}
@@ -387,8 +387,8 @@ export function EulerSwapViz(props) {
387387
let setFee = (v) => setParams({ ...params, fee: v });
388388
let setPrice = (v) => setParams({ ...params, price: v });
389389

390-
let ltv0Pixel = fundSpaceToPixel(width, domain, ltv0);
391-
let ltv1Pixel = fundSpaceToPixel(width, domain, ltv1);
390+
let limit0Pixel = fundSpaceToPixel(width, domain, limit0);
391+
let limit1Pixel = fundSpaceToPixel(width, domain, limit1);
392392
let curveLeftPixel = fundSpaceToPixel(width, domain, params.curveLeft);
393393
let curveMidPixel = fundSpaceToPixel(width, domain, params.curveMid);
394394
let curveRightPixel = fundSpaceToPixel(width, domain, params.curveRight);
@@ -629,8 +629,8 @@ export function EulerSwapViz(props) {
629629

630630

631631
<div className="flex mt-6" ref={observe} style={{ marginTop: 10, width: '100%', position: 'relative', overflowX: 'clip', height: 140 }}>
632-
<FundsSpace width={width} domain={domain} color="white" style={{ borderLeft: '5px dashed crimson', }} from={ltv0} to={ltv0} mark height={90} top={-30} tooltip={`Max ${ctx.renderVaultAsset(props.vault0)}/${ctx.renderVaultAsset(props.vault1)} position`} />
633-
<FundsSpace width={width} domain={domain} color="white" style={{ borderRight: '5px dashed crimson', }} from={ltv1} to={ltv1} mark height={90} top={-30} tooltip={`Max ${ctx.renderVaultAsset(props.vault1)}/${ctx.renderVaultAsset(props.vault0)} position`} />
632+
<FundsSpace width={width} domain={domain} color="white" style={{ borderLeft: '5px dashed crimson', }} from={limit0} to={limit0} mark height={90} top={-30} tooltip={`Max ${ctx.renderVaultAsset(props.vault0)}/${ctx.renderVaultAsset(props.vault1)} position`} />
633+
<FundsSpace width={width} domain={domain} color="white" style={{ borderRight: '5px dashed crimson', }} from={limit1} to={limit1} mark height={90} top={-30} tooltip={`Max ${ctx.renderVaultAsset(props.vault1)}/${ctx.renderVaultAsset(props.vault0)} position`} />
634634

635635
{genVaultDisp(props.vault0, v0status, -1)}
636636
{genVaultDisp(props.vault1, v1status, 1)}
@@ -646,7 +646,7 @@ export function EulerSwapViz(props) {
646646

647647
<FundsSpace width={width} domain={domain} from={params.curveMid} to={params.curveMid} height={60} top={30} mark style={{ border: '3px dotted #7ab5ff',}} tooltip="Curve Equilibrium" />
648648

649-
{!props.viewMode && <Draggable nodeRef={leftNodeRef} axis="x" position={{ x: curveLeftPixel, y: 0, }} bounds={{ left: ltv0Pixel, right: Math.min(curveMidPixel, navMidpointPixel), }} onDrag={onDragLeft}>
649+
{!props.viewMode && <Draggable nodeRef={leftNodeRef} axis="x" position={{ x: curveLeftPixel, y: 0, }} bounds={{ left: limit0Pixel, right: Math.min(curveMidPixel, navMidpointPixel), }} onDrag={onDragLeft}>
650650
<div ref={leftNodeRef} style={{ marginTop: 62.5, fontSize: 20, marginLeft: -20, }}>
651651
<span style={{ backgroundColor: 'blue', borderRadius: 5 }}>&#x21c6;</span>
652652
</div>
@@ -658,7 +658,7 @@ export function EulerSwapViz(props) {
658658
</div>
659659
</Draggable>}
660660

661-
{!props.viewMode && <Draggable nodeRef={rightNodeRef} axis="x" position={{ x: curveRightPixel, y: 0, }} bounds={{ left: Math.max(curveMidPixel, navMidpointPixel), right: ltv1Pixel, }} onDrag={onDragRight}>
661+
{!props.viewMode && <Draggable nodeRef={rightNodeRef} axis="x" position={{ x: curveRightPixel, y: 0, }} bounds={{ left: Math.max(curveMidPixel, navMidpointPixel), right: limit1Pixel, }} onDrag={onDragRight}>
662662
<div ref={rightNodeRef} style={{ marginTop: 62.5, fontSize: 20, }}>
663663
<span style={{ backgroundColor: 'blue', borderRadius: 5 }}>&#x21c6;</span>
664664
</div>

0 commit comments

Comments
 (0)