Fix half duplex transfer watcher
This commit is contained in:
parent
12229e5e0b
commit
1360c79e69
@ -14,7 +14,7 @@ let validatorContract = null
|
|||||||
|
|
||||||
function processTransfersBuilder(config) {
|
function processTransfersBuilder(config) {
|
||||||
const homeBridge = new web3Home.eth.Contract(config.homeBridgeAbi, config.homeBridgeAddress)
|
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(
|
const userRequestForAffirmationAbi = config.foreignBridgeAbi.filter(
|
||||||
e => e.type === 'event' && e.name === 'UserRequestForAffirmation'
|
e => e.type === 'event' && e.name === 'UserRequestForAffirmation'
|
||||||
)[0]
|
)[0]
|
||||||
@ -45,7 +45,7 @@ function processTransfersBuilder(config) {
|
|||||||
logger.info({ from, value }, `Processing transfer ${transfer.transactionHash}`)
|
logger.info({ from, value }, `Processing transfer ${transfer.transactionHash}`)
|
||||||
|
|
||||||
const block = await web3Foreign.eth.getBlock(blockNumber)
|
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) {
|
if (!tokenSwapAllowed) {
|
||||||
logger.info(
|
logger.info(
|
||||||
|
@ -21,6 +21,7 @@ const processSignatureRequests = require('./events/processSignatureRequests')(co
|
|||||||
const processCollectedSignatures = require('./events/processCollectedSignatures')(config)
|
const processCollectedSignatures = require('./events/processCollectedSignatures')(config)
|
||||||
const processAffirmationRequests = require('./events/processAffirmationRequests')(config)
|
const processAffirmationRequests = require('./events/processAffirmationRequests')(config)
|
||||||
const processTransfers = require('./events/processTransfers')(config)
|
const processTransfers = require('./events/processTransfers')(config)
|
||||||
|
const processHalfDuplexTransfers = require('./events/processHalfDuplexTransfers')(config)
|
||||||
const processAMBSignatureRequests = require('./events/processAMBSignatureRequests')(config)
|
const processAMBSignatureRequests = require('./events/processAMBSignatureRequests')(config)
|
||||||
const processAMBCollectedSignatures = require('./events/processAMBCollectedSignatures')(config)
|
const processAMBCollectedSignatures = require('./events/processAMBCollectedSignatures')(config)
|
||||||
const processAMBAffirmationRequests = require('./events/processAMBAffirmationRequests')(config)
|
const processAMBAffirmationRequests = require('./events/processAMBAffirmationRequests')(config)
|
||||||
@ -102,8 +103,9 @@ function processEvents(events, blockNumber) {
|
|||||||
return processAffirmationRequests(events)
|
return processAffirmationRequests(events)
|
||||||
case 'erc-erc-transfer':
|
case 'erc-erc-transfer':
|
||||||
case 'erc-native-transfer':
|
case 'erc-native-transfer':
|
||||||
|
return processTransfers(events)
|
||||||
case 'erc-native-half-duplex-transfer':
|
case 'erc-native-half-duplex-transfer':
|
||||||
return processTransfers(events, blockNumber)
|
return processHalfDuplexTransfers(events, blockNumber)
|
||||||
case 'amb-signature-request':
|
case 'amb-signature-request':
|
||||||
return processAMBSignatureRequests(events)
|
return processAMBSignatureRequests(events)
|
||||||
case 'amb-collected-signatures':
|
case 'amb-collected-signatures':
|
||||||
@ -152,7 +154,7 @@ async function main({ sendToQueue, sendToWorker }) {
|
|||||||
await sendToWorker({ blockNumber: toBlock.toString() })
|
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)
|
logger.info('Transactions to send:', job.length)
|
||||||
|
|
||||||
if (job.length) {
|
if (job.length) {
|
||||||
|
Loading…
Reference in New Issue
Block a user