Skip to content

How to use larger than MAX_SAFE_NUMBER in ERC20 transferTo? #1724

Answered by ricmoo
emclab asked this question in Q&A
Discussion options

You must be logged in to vote

You must use a safe way to create a BigNumber instance. For example, all these produce the same value:

BigNumber.from("1000000000000000")
BigNumber.from(10).pow(18)

// the best way is to use the parseEther and parseUnits method
parseEther("1.0")
parseUnits("1.0", 18)

I recommend taking a quick look through the docs. The getting started document covers this and many other useful examples. :)

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@emclab
Comment options

Answer selected by emclab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants