Error When Using BigNumber As Arguement to Contract Function
See original GitHub issueWhen I try to us a very large number as an argument to a contract function I get a huge string of text in my console. I can’t even see what the error is because there is too much text output.
For example I try to do this:
const id = ethers.BigNumber.from(1).mul(ethers.BigNumber.from(2).pow(240))
console.log(id.toString())
await wearables.transferToParent(accounts[0], aavegotchiDiamond.address, 0, id.toHexString(), 1)
How do I pass a very large number to a contract function using ethers.js?
I am using @nomiclabs/buidler-ethers": “^2.0.0”
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (1 by maintainers)
Top Results From Across the Web
BigNumber error - solidity - Ethereum Stack Exchange
Your contract works fine. As the two previous replies mentioned, you're "deploying" your contract with a void input.
Read more >Unable to call contract function from web3 with big number as ...
I am trying to call a custom function of a contract that expects a parameter of unit256. I'm calling this function from web3...
Read more >Error: invalid BigNumber value (argument="value ... - GitHub
Lottery.js: Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.7.0) at Logger.
Read more >invalid bignumber string (argument= value - You.com | The AI ...
The error happens when you're trying to call the people() function (from Remix IDE) without passing any value. Since the People[] public people...
Read more >Documentation - Ethers.js
Ethers' various Classes and Functions are available to import manually from ... to a specific contract on the Ethereum Network, so that applications...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh nevermind, the problem was disrelated to BigNumber. I was using the wrong type in another argument. It was hard to debug because my output was a huge unreadable mess which was too big for my console to display so I didn’t see any error.
So fixed the problem. @zemse Thanks for your help and for looking into this.
Thanks @zemse ! I was just checking in on this and was going to ask for the error too. 😃
Glad it’s all figured out. 😃