-
-
Save ajb413/61cd77039d62dc71d9d6456500f755d1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function renderTableRows(borrowerData, from=0, to=999) { | |
let htmlRows = [ | |
( | |
<tr key="head"> | |
<th>Account</th> | |
<th>Borrow Balance</th> | |
<th>Liquidation Price</th> | |
<th>Percent To Liquidation</th> | |
<th>Borrow Limit</th> | |
<th>Get Liquidated Borrow Balance</th> | |
</tr> | |
) | |
]; | |
borrowerData.borrowers.forEach((row, i) => { | |
if (i >= from && i <= to) { | |
const lp = +row.liquidationPrice; | |
htmlRows.push(( | |
<tr key={row.account}> | |
<td>{ row.account }</td> | |
<td>{ commafy(row.borrowBalance, 2) }</td> | |
<td>{ lp ? '$' + commafy(lp, 2) : '' }</td> | |
<td>{ commafy(row.percentToLiquidation, 0) }%</td> | |
<td>{ commafy(row.borrowLimit, 2) }</td> | |
<td>{ commafy(row.liquidationLimit, 2) }</td> | |
</tr> | |
)); | |
} | |
}); | |
return htmlRows; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment