INNER CODE UNIT · JavaScript

usableEth

pamgarcia1993/robinhood-lp-bot · legacy/bot.js:56

function usableEth(b) {
  return Number(b.weth) + Math.max(0, Number(b.eth) - GAS_RESERVE);
}

// Pilih pool → TANYA jumlah ETH (user ketik sendiri)
async function onPick(idx, mid) {
  const st = pending.get(chatId);
  if (!st) return;
  const p = st.pools[idx];
  st.chosen = p;
  st.awaitingAmount = true;
  const b = await CH.balances().catch(() => null);
  await edit(mid, [
    `<b>${st.meta.symbol}</b> · fee ${(p.fee / 10000).toFixed(2)}% dipilih.`,
    b ? `Saldo bisa di-LP: <b>${usableEth(b).toFixed(5)} ETH</b>  <i>(WETH ${Number(b.weth).toFixed(4)} + ETH ${Number(b.eth).toFixed(4)})</i>` : "",
    ``,
    `💬 <b>Ketik jumlah ETH</b> yang mau di-LP (contoh: <code>0.005</code>)`,
  ].filter(Boolean).join("\n"));

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…