Fix a fix for sending TX for tokens with decimals other than 24
This commit is contained in:
parent
b667f438ee
commit
19ce5abd48
|
@ -18,7 +18,7 @@ import { copyToClipboard } from '~/utils/clipboard'
|
|||
import Hairline from '~/components/layout/Hairline'
|
||||
import SafeInfo from '~/routes/safe/components/Balances/SendModal/SafeInfo'
|
||||
import { setImageToPlaceholder } from '~/routes/safe/components/Balances/utils'
|
||||
import { getStandardTokenContract } from '~/logic/tokens/store/actions/fetchTokens'
|
||||
import { getStandardTokenContract, getHumanFriendlyToken } from '~/logic/tokens/store/actions/fetchTokens'
|
||||
import { EMPTY_DATA } from '~/logic/wallets/ethTransactions'
|
||||
import { getWeb3 } from '~/logic/wallets/getWeb3'
|
||||
import { TX_NOTIFICATION_TYPES } from '~/logic/safe/transactions'
|
||||
|
@ -68,9 +68,11 @@ const ReviewTx = ({
|
|||
|
||||
if (!isSendingETH) {
|
||||
const StandardToken = await getStandardTokenContract()
|
||||
const HumanFriendlyToken = await getHumanFriendlyToken()
|
||||
const tokenInstance = await StandardToken.at(tx.token.address)
|
||||
const decimals = await tokenInstance.decimals()
|
||||
txAmount = new BigNumber(tx.amount).div(10 ** decimals).toString()
|
||||
const hfTokenInstance = await HumanFriendlyToken.at(tx.token.address)
|
||||
const decimals = await hfTokenInstance.decimals()
|
||||
txAmount = new BigNumber(tx.amount).times(10 ** decimals.toNumber()).toString()
|
||||
|
||||
txData = tokenInstance.contract.methods.transfer(tx.recipientAddress, txAmount).encodeABI()
|
||||
// txAmount should be 0 if we send tokens
|
||||
|
|
Loading…
Reference in New Issue