Include cDAI balance in balanceDiff (#613)

This commit is contained in:
Kirill Fedoseev 2021-10-11 12:14:55 +03:00 committed by GitHub
parent d36dcadd34
commit 52e1c88b58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -66,7 +66,13 @@ async function main(bridgeMode, eventsInfo) {
const mintedCoinsBN = new BN(mintedCoins)
const burntCoinsBN = new BN(burntCoins)
const totalSupplyBN = mintedCoinsBN.minus(burntCoinsBN)
const foreignErc20BalanceBN = new BN(foreignErc20Balance).plus(lateForeignConfirmationsTotalValue)
let foreignErc20BalanceBN = new BN(foreignErc20Balance).plus(lateForeignConfirmationsTotalValue)
try {
const invested = await foreignBridge.methods.investedAmount(erc20Address).call({}, foreignDelayedBlockNumber)
foreignErc20BalanceBN = foreignErc20BalanceBN.plus(invested)
} catch (_) {
logger.debug('compounding related methods are not present in the foreign bridge')
}
const diff = foreignErc20BalanceBN.minus(totalSupplyBN).toFixed()
logger.debug('Done')