瀏覽代碼

round wei to avoid conv errors (#2864)

Tejas Badadare 4 月之前
父節點
當前提交
dc4fd5ce60
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      contract_manager/scripts/transfer_balance_entropy_chains.ts

+ 3 - 0
contract_manager/scripts/transfer_balance_entropy_chains.ts

@@ -160,6 +160,9 @@ async function transferOnChain(
       transferAmountEth = (balanceEth - gasCostEth) * transferRatio!;
     }
 
+    // Round to 10 decimal places to avoid Web3 conversion errors
+    transferAmountEth = Math.round(transferAmountEth * 1e10) / 1e10;
+
     // Validate transfer amount
     if (transferAmountEth <= 0) {
       console.log(