Fix monitor balances displayed for erc to native (#312)
This commit is contained in:
parent
7b0edff624
commit
c8c589536b
@ -3,6 +3,7 @@ const BN = require('bignumber.js')
|
|||||||
const Web3 = require('web3')
|
const Web3 = require('web3')
|
||||||
const logger = require('./logger')('getBalances')
|
const logger = require('./logger')('getBalances')
|
||||||
const { BRIDGE_MODES } = require('../commons')
|
const { BRIDGE_MODES } = require('../commons')
|
||||||
|
const { blockNumberHalfDuplexDisabled } = require('./utils/tokenUtils')
|
||||||
|
|
||||||
const Web3Utils = Web3.utils
|
const Web3Utils = Web3.utils
|
||||||
|
|
||||||
@ -94,7 +95,9 @@ async function main(bridgeMode) {
|
|||||||
if (halfDuplexTokenAddress !== erc20Address) {
|
if (halfDuplexTokenAddress !== erc20Address) {
|
||||||
const halfDuplexToken = new web3Foreign.eth.Contract(ERC20_ABI, halfDuplexTokenAddress)
|
const halfDuplexToken = new web3Foreign.eth.Contract(ERC20_ABI, halfDuplexTokenAddress)
|
||||||
logger.debug('calling halfDuplexToken.methods.balanceOf')
|
logger.debug('calling halfDuplexToken.methods.balanceOf')
|
||||||
foreignHalfDuplexErc20Balance = await halfDuplexToken.methods.balanceOf(COMMON_FOREIGN_BRIDGE_ADDRESS).call()
|
foreignHalfDuplexErc20Balance = await halfDuplexToken.methods
|
||||||
|
.balanceOf(COMMON_FOREIGN_BRIDGE_ADDRESS)
|
||||||
|
.call(null, blockNumberHalfDuplexDisabled)
|
||||||
logger.debug('getting last block numbers')
|
logger.debug('getting last block numbers')
|
||||||
const block = await web3Foreign.eth.getBlock('latest')
|
const block = await web3Foreign.eth.getBlock('latest')
|
||||||
|
|
||||||
@ -139,8 +142,7 @@ async function main(bridgeMode) {
|
|||||||
const foreignErc20BalanceBN = new BN(foreignErc20Balance)
|
const foreignErc20BalanceBN = new BN(foreignErc20Balance)
|
||||||
const investedAmountInDaiBN = new BN(investedAmountInDai)
|
const investedAmountInDaiBN = new BN(investedAmountInDai)
|
||||||
const bridgeDsrBalanceBN = new BN(bridgeDsrBalance)
|
const bridgeDsrBalanceBN = new BN(bridgeDsrBalance)
|
||||||
const halfDuplexErc20BalanceBN =
|
const halfDuplexErc20BalanceBN = displayHalfDuplexToken ? new BN(foreignHalfDuplexErc20Balance) : new BN(0)
|
||||||
displayHalfDuplexToken && tokenSwapAllowed ? new BN(foreignHalfDuplexErc20Balance) : new BN(0)
|
|
||||||
|
|
||||||
const diff = foreignErc20BalanceBN
|
const diff = foreignErc20BalanceBN
|
||||||
.plus(halfDuplexErc20BalanceBN)
|
.plus(halfDuplexErc20BalanceBN)
|
||||||
|
@ -22,5 +22,6 @@ async function filterTransferBeforeES(array) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
filterTransferBeforeES
|
filterTransferBeforeES,
|
||||||
|
blockNumberHalfDuplexDisabled
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user