Safe-react: Contract Interaction fails to handle big numbers

Created on 3 Feb 2021  路  1Comment  路  Source: gnosis/safe-react

Title/Description


Contract interaction arguments are _JSON.parsed_, and this leads to JS casting string representation numbers to the scientific notation (see screenshot, encodeABI ends up receiving 7.5e+21 instead of "7500000000000000000000")

The error is produced when this line is called: https://github.com/gnosis/safe-react/blob/038b51e3983d44cdcf27a201cf0949dffec8ab10/src/routes/safe/components/Balances/SendModal/screens/ContractInteraction/utils/index.ts#L95

Environment

  • Browser: all
  • Safe: all
  • App Version: 2.19.1
  • Environment:


    • dev (rinkeby)

    • staging (rinkeby)

    • production (mainnet)

Steps to reproduce

  1. Go to 'Contract Interaction'
  2. load any method with an argument of type uint256
  3. Put a big number as 7500000000000000000000
  4. Click Review

Expected result


The form is valid, review screen must have appeared

Obtained result


Error due to the argument type

Screenshots


image

Bug 馃悰

Most helpful comment

>All comments

Was this page helpful?
0 / 5 - 0 ratings