Fix half duplex transfer watcher

This commit is contained in:
Gerardo Nardelli 2019-12-02 17:19:28 -03:00
parent 12229e5e0b
commit 1360c79e69
2 changed files with 6 additions and 4 deletions

@ -14,7 +14,7 @@ let validatorContract = null
function processTransfersBuilder(config) {
const homeBridge = new web3Home.eth.Contract(config.homeBridgeAbi, config.homeBridgeAddress)
const foreignBridge = new web3Home.eth.Contract(config.foreignBridgeAbi, config.foreignBridgeAddress)
const foreignBridge = new web3Foreign.eth.Contract(config.foreignBridgeAbi, config.foreignBridgeAddress)
const userRequestForAffirmationAbi = config.foreignBridgeAbi.filter(
e => e.type === 'event' && e.name === 'UserRequestForAffirmation'
)[0]
@ -45,7 +45,7 @@ function processTransfersBuilder(config) {
logger.info({ from, value }, `Processing transfer ${transfer.transactionHash}`)
const block = await web3Foreign.eth.getBlock(blockNumber)
const tokenSwapAllowed = await foreignBridge.methods.isTokenSwapAllowed(block.timestamp)
const tokenSwapAllowed = await foreignBridge.methods.isTokenSwapAllowed(block.timestamp).call()
if (!tokenSwapAllowed) {
logger.info(

@ -21,6 +21,7 @@ const processSignatureRequests = require('./events/processSignatureRequests')(co
const processCollectedSignatures = require('./events/processCollectedSignatures')(config)
const processAffirmationRequests = require('./events/processAffirmationRequests')(config)
const processTransfers = require('./events/processTransfers')(config)
const processHalfDuplexTransfers = require('./events/processHalfDuplexTransfers')(config)
const processAMBSignatureRequests = require('./events/processAMBSignatureRequests')(config)
const processAMBCollectedSignatures = require('./events/processAMBCollectedSignatures')(config)
const processAMBAffirmationRequests = require('./events/processAMBAffirmationRequests')(config)
@ -102,8 +103,9 @@ function processEvents(events, blockNumber) {
return processAffirmationRequests(events)
case 'erc-erc-transfer':
case 'erc-native-transfer':
return processTransfers(events)
case 'erc-native-half-duplex-transfer':
return processTransfers(events, blockNumber)
return processHalfDuplexTransfers(events, blockNumber)
case 'amb-signature-request':
return processAMBSignatureRequests(events)
case 'amb-collected-signatures':
@ -152,7 +154,7 @@ async function main({ sendToQueue, sendToWorker }) {
await sendToWorker({ blockNumber: toBlock.toString() })
}
const job = await processEvents(events, toBlock)
const job = await processEvents(events, toBlock.toString())
logger.info('Transactions to send:', job.length)
if (job.length) {