Skip to content

Instantly share code, notes, and snippets.

@ajb413

ajb413/App.tsx Secret

Created December 12, 2022 17:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ajb413/61cd77039d62dc71d9d6456500f755d1 to your computer and use it in GitHub Desktop.
Save ajb413/61cd77039d62dc71d9d6456500f755d1 to your computer and use it in GitHub Desktop.
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