From d35cbca2105f21324e1c0a744a4d1201fc6b2e0c Mon Sep 17 00:00:00 2001 From: raviycoder <135521192+raviycoder@users.noreply.github.com> Date: Mon, 22 Jul 2024 14:34:43 +0530 Subject: [PATCH] resolve error on transaction --- scripts/ethOperator_polygon.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/ethOperator_polygon.js b/scripts/ethOperator_polygon.js index 09821e9..c3f2f8a 100644 --- a/scripts/ethOperator_polygon.js +++ b/scripts/ethOperator_polygon.js @@ -360,8 +360,10 @@ BEP20ABI, wallet ); + + const decimals = await tokenContract.decimals(); // Convert the amount to the smallest unit of USDC (wei) - const amountWei = ethers.utils.parseUnits(amount.toString(), 6); // Assuming 6 decimals for USDC + const amountWei = ethers.utils.parseUnits(amount.toString(), decimals); // Assuming 6 decimals for USDC // Call the transfer function on the USDC contract return tokenContract.transfer(receiver, amountWei);