2019-10-29 17:55:47 +03:00
|
|
|
const baseConfig = require('./base.config')
|
2021-05-08 18:50:46 +03:00
|
|
|
const { ERC20_ABI } = require('../../commons')
|
2019-10-29 17:55:47 +03:00
|
|
|
const { EXIT_CODES } = require('../src/utils/constants')
|
|
|
|
|
|
|
|
const initialChecksJson = process.argv[3]
|
|
|
|
|
|
|
|
if (!initialChecksJson) {
|
|
|
|
throw new Error('initial check parameter was not provided.')
|
|
|
|
}
|
|
|
|
|
|
|
|
let initialChecks
|
|
|
|
try {
|
|
|
|
initialChecks = JSON.parse(initialChecksJson)
|
|
|
|
} catch (e) {
|
|
|
|
throw new Error('Error on decoding values from initial checks.')
|
|
|
|
}
|
|
|
|
|
|
|
|
const id = `${baseConfig.id}-transfer`
|
|
|
|
|
2021-05-08 18:50:46 +03:00
|
|
|
if (baseConfig.id !== 'erc-native') {
|
2019-10-29 17:55:47 +03:00
|
|
|
console.error(`Transfer watcher not required for bridge mode ${process.env.ORACLE_BRIDGE_MODE}`)
|
|
|
|
process.exit(EXIT_CODES.WATCHER_NOT_REQUIRED)
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
2021-05-09 16:34:19 +03:00
|
|
|
...baseConfig,
|
|
|
|
main: {
|
|
|
|
...baseConfig.foreign,
|
|
|
|
eventContract: new baseConfig.foreign.web3.eth.Contract(ERC20_ABI, initialChecks.bridgeableTokenAddress)
|
|
|
|
},
|
2019-10-29 17:55:47 +03:00
|
|
|
event: 'Transfer',
|
|
|
|
eventFilter: { to: process.env.COMMON_FOREIGN_BRIDGE_ADDRESS },
|
2020-09-12 17:01:37 +03:00
|
|
|
queue: 'home-prioritized',
|
2019-10-29 17:55:47 +03:00
|
|
|
name: `watcher-${id}`,
|
|
|
|
id
|
|
|
|
}
|