diff --git a/oracle/src/events/processHalfDuplexTransfers/index.js b/oracle/src/events/processHalfDuplexTransfers/index.js index bbbd22d1..fafc0b6b 100644 --- a/oracle/src/events/processHalfDuplexTransfers/index.js +++ b/oracle/src/events/processHalfDuplexTransfers/index.js @@ -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( diff --git a/oracle/src/watcher.js b/oracle/src/watcher.js index 74309a99..7151acc1 100644 --- a/oracle/src/watcher.js +++ b/oracle/src/watcher.js @@ -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) {