celo-org / developer-tooling

🛠️ SDKs and CLI for interacting with Celo
Apache License 2.0
10 stars 6 forks source link

`celocli transfer:erc20` works as expected, but info message assumes token has 18 decimals #158

Open arthurgousset opened 7 months ago

arthurgousset commented 7 months ago

Package

@celo/celocli

Have you ensured that all of these are up to date?

What version of the package are you on?

@celo/celocli@4.0.0

What command or function is the bug in?

celocli transfer:erc20

Operating System

macOS (Apple Silicon)

Describe the bug

The error message formats the "acount has at least" message using the token has 18 decimals.

$ celocli transfer:erc20 --erc20Address 0x780c1551C2Be3ea3B1f8b1E4CeDc9C3CE40da24E --from 0x303C22e6ef01CbA9d03259248863836CB91336D5 --to 0x5111A8caCa3366389EeaAad8a49027d573588BbB --value 10e18 --privateKey $PRIVATE_KEY --node alfajores

Running Checks:
   ✘  Account has at least 10 erc20 token 
 ›   Error: Some checks didn't pass!

That's not always the case, USDC has 6 decimals.

The check works as intended, but the error message is not informative for the user, because it's incorrectly stating what was checked.

$ celocli transfer:erc20 --erc20Address 0x780c1551C2Be3ea3B1f8b1E4CeDc9C3CE40da24E --from 0x303C22e6ef01CbA9d03259248863836CB91336D5 --to 0x5111A8caCa3366389EeaAad8a49027d573588BbB --value 10e6 --privateKey $PRIVATE_KEY --node alfajores 

Running Checks:
   ✔  Account has at least 0.00000000001 erc20 token 
All checks passed
SendTransaction: transfer
txHash: 0x1fc7d0036391867437ed27ad56d77a79afc08d47d7096612d7751f61f0abeef0
Sending Transaction: transfer... done

Some options:

aaronmgdr commented 6 months ago

dont spend much time on this