feat: change to generic ERC-20 ABI json file

fix: coinUtils rename import
This commit is contained in:
Sérgio Salgado 2021-06-10 01:43:22 +01:00 committed by Josh Harvey
parent dff407e30e
commit 8e099e3283
36 changed files with 364 additions and 249 deletions

View file

@ -8,7 +8,7 @@ const util = require('ethereumjs-util')
const coins = require('lamassu-coins')
const pify = require('pify')
const BN = require('../../../bn')
const erc20ABIs = require('../../erc20')
const ABI = require('../../tokens')
const NAME = 'geth'
exports.SUPPORTED_MODULES = ['wallet']
@ -84,7 +84,7 @@ const confirmedBalance = (address, cryptoCode) => _balance(false, address, crypt
function _balance (includePending, address, cryptoCode) {
if (coins.utils.getCryptoCurrency(cryptoCode).type === 'erc-20') {
const contract = web3.eth.contract(erc20ABIs[cryptoCode]).at(coins.utils.getErc20Token(cryptoCode).contractAddress)
const contract = web3.eth.contract(ABI.ERC20).at(coins.utils.getErc20Token(cryptoCode).contractAddress)
return contract.balanceOf(address.toLowerCase())
}
const block = includePending ? 'pending' : undefined
@ -98,7 +98,7 @@ function generateTx (toAddress, wallet, amount, includesFee, cryptoCode) {
}
function generateContractTx (_toAddress, wallet, amount, includesFee, cryptoCode) {
const contract = web3.eth.contract(erc20ABIs[cryptoCode]).at(coins.utils.getErc20Token(cryptoCode).contractAddress)
const contract = web3.eth.contract(ABI.ERC20).at(coins.utils.getErc20Token(cryptoCode).contractAddress)
const fromAddress = '0x' + wallet.getAddress().toString('hex')
const toAddress = _toAddress.toLowerCase()