From 19029819e20fa4bc2285a0b0850d1a1ef98c484a Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Fri, 4 Oct 2019 17:09:29 +0400 Subject: [PATCH] Fix sending TX for tokens with decimals other than 24 --- .../components/Balances/SendModal/screens/ReviewTx/index.jsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx index bfa82e58..05fa129c 100644 --- a/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx +++ b/src/routes/safe/components/Balances/SendModal/screens/ReviewTx/index.jsx @@ -1,5 +1,6 @@ // @flow import React from 'react' +import { BigNumber } from 'bignumber.js' import OpenInNew from '@material-ui/icons/OpenInNew' import { withStyles } from '@material-ui/core/styles' import Close from '@material-ui/icons/Close' @@ -68,6 +69,8 @@ const ReviewTx = ({ if (!isSendingETH) { const StandardToken = await getStandardTokenContract() const tokenInstance = await StandardToken.at(tx.token.address) + const decimals = await tokenInstance.decimals() + txAmount = new BigNumber(tx.amount).div(10 ** decimals).toString() txData = tokenInstance.contract.methods.transfer(tx.recipientAddress, txAmount).encodeABI() // txAmount should be 0 if we send tokens